Skip to content

security: fail closed cloud eviction without identity-bound recycle - #172

Merged
seonghobae merged 5 commits into
mainfrom
security/cloud-eviction-fail-closed-v1
Aug 11, 2026
Merged

security: fail closed cloud eviction without identity-bound recycle#172
seonghobae merged 5 commits into
mainfrom
security/cloud-eviction-fail-closed-v1

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Security boundary

Closes the cloud_eviction production manifestation of #170: the current adapter stages and revalidates the authorized source identity, then hands a pathname to the OS-trash helper. A same-user actor can still replace that pathname between the final validation and the path-consuming recycle operation. Private 0700 staging excludes other users but not the same UID.

Test-first state

This draft intentionally starts RED with a production-path regression that requires evict_source_with_human_approval to fail closed before any eviction record, journal, staging, or recycle mutation when no object-identity-bound reversible recycle primitive is available. The authorized source must remain byte-identical and present.

The smallest safe remedy is fail-closed production behavior until a reversible recycle primitive can bind the actual authorized filesystem object identity at the mutation boundary. Another metadata/path recheck cannot close the race; descriptor-relative permanent deletion would violate DiskSage's reversible-delete contract.

This PR is intentionally Draft until the RED boundary is observed, the narrow production fix turns it GREEN, and exact-head CI/security/review evidence is revalidated.

Summary by CodeRabbit

  • 버그 수정
    • 클라우드 소스 퇴출 시 승인 영수증의 식별자가 일치하지 않으면 작업을 즉시 거부합니다.
    • 신원 기반 재활용 기능을 사용할 수 없는 경우에도 소스 퇴출을 진행하지 않습니다.
    • 검증에 실패하면 파일과 관련 디렉터리를 변경하지 않아 데이터 손상을 방지합니다.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@seonghobae, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e89e7e6e-66e4-4109-a90d-ea4db239a73f

📥 Commits

Reviewing files that changed from the base of the PR and between 9b40ea9 and 50bbf9f.

📒 Files selected for processing (1)
  • src-tauri/tests/cloud_eviction_fail_closed.rs
📝 Walkthrough

Walkthrough

인간 승인 기반 클라우드 소스 퇴출이 확인용 영수증 ID를 먼저 검증하도록 변경되었습니다. identity-bound recycling 기능이 없으면 지정 오류로 거부합니다. 관련 테스트는 원본 파일, 퇴출 디렉터리, 저널이 변경되지 않음을 검증합니다.

Changes

클라우드 소스 퇴출 fail-closed

Layer / File(s) Summary
퇴출 승인 검증 순서
src-tauri/src/cloud_eviction.rs
확인용 영수증 ID를 active-use 검사보다 먼저 검증합니다. identity-bound recycling 기능이 없으면 source-eviction-identity-bound-recycle-unavailable 오류를 반환합니다.
Fail-closed 퇴출 테스트
src-tauri/tests/cloud_eviction_fail_closed.rs
유효한 영수증과 비활성 사용 상태를 구성합니다. recycling 기능이 없거나 영수증 ID가 불일치하면 퇴출이 실패하고 관련 파일시스템 항목이 변경되지 않음을 검증합니다.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 신원 바인딩 재활용 기능이 없을 때 클라우드 퇴출을 안전하게 실패하도록 변경한 주요 내용을 정확하고 간결하게 설명합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch security/cloud-eviction-fail-closed-v1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src-tauri/tests/cloud_eviction_fail_closed.rs (1)

141-144: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

staging directory 불변 조건을 두 테스트에서 검증하십시오.

현재 assertion은 eviction record와 journal만 검사합니다. src-tauri/src/cloud_eviction.rs는 staging directory도 생성할 수 있으므로, gate 위치가 나중에 변경되면 source를 복원해도 이 테스트는 통과할 수 있습니다.

  • src-tauri/tests/cloud_eviction_fail_closed.rs#L141-L144: source.parent()receipt.receipt_id에서 staging directory 경로를 구성하고, 해당 경로가 존재하지 않는지 검사하십시오.
  • src-tauri/tests/cloud_eviction_fail_closed.rs#L177-L180: 잘못된 confirmation ID 경로에도 같은 staging directory 부재 assertion을 추가하십시오.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src-tauri/tests/cloud_eviction_fail_closed.rs` around lines 141 - 144, 두
테스트에서 source.parent()와 receipt.receipt_id로 staging directory 경로를 구성하고, 해당 경로가
존재하지 않는지 검증하십시오. 앵커 위치 src-tauri/tests/cloud_eviction_fail_closed.rs#L141-L144와
sibling 위치 src-tauri/tests/cloud_eviction_fail_closed.rs#L177-L180 모두에 동일한
staging directory 부재 assertion을 추가하고, 기존 eviction record·journal 검증은 유지하십시오.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src-tauri/tests/cloud_eviction_fail_closed.rs`:
- Around line 9-11: Update prepare_cloud_copy and the cloud eviction test
integration so cloud_eviction_fail_closed.rs no longer depends on a
library-unit-test-only symbol guarded by #[cfg(all(test, not(coverage)))].
Either expose a supported public API for integration tests or change the test to
construct valid receipt and permit values using existing public APIs, while
preserving the test’s fail-closed behavior.

---

Nitpick comments:
In `@src-tauri/tests/cloud_eviction_fail_closed.rs`:
- Around line 141-144: 두 테스트에서 source.parent()와 receipt.receipt_id로 staging
directory 경로를 구성하고, 해당 경로가 존재하지 않는지 검증하십시오. 앵커 위치
src-tauri/tests/cloud_eviction_fail_closed.rs#L141-L144와 sibling 위치
src-tauri/tests/cloud_eviction_fail_closed.rs#L177-L180 모두에 동일한 staging
directory 부재 assertion을 추가하고, 기존 eviction record·journal 검증은 유지하십시오.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 867ec87f-d0d2-4442-8a27-6085990e0881

📥 Commits

Reviewing files that changed from the base of the PR and between 7b81efd and 9b40ea9.

📒 Files selected for processing (2)
  • src-tauri/src/cloud_eviction.rs
  • src-tauri/tests/cloud_eviction_fail_closed.rs

Comment thread src-tauri/tests/cloud_eviction_fail_closed.rs

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@seonghobae
seonghobae marked this pull request as ready for review August 11, 2026 14:21
@seonghobae
seonghobae merged commit 4f17287 into main Aug 11, 2026
33 checks passed
@seonghobae
seonghobae deleted the security/cloud-eviction-fail-closed-v1 branch August 11, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant