security: harden provider evidence directory - #179
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughUnix 환경에서 provider evidence 디렉터리의 그룹 및 기타 사용자 쓰기 권한을 검사합니다. 권한이 있으면 지정된 오류를 반환하고 evidence 파일을 생성하지 않습니다. 해당 동작을 검증하는 회귀 테스트를 추가했습니다. ChangesProvider evidence 디렉터리 권한
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src-tauri/tests/provider_evidence_directory_authority.rs (1)
11-17: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win그룹 쓰기와 기타 사용자 쓰기를 별도로 검증하세요.
현재 테스트는
0o777만 사용합니다. 이 값은 두 쓰기 비트를 동시에 설정합니다. 구현이 한 비트만 검사하도록 회귀해도 테스트가 통과할 수 있습니다.0o020과0o002를 각각 사용하는 케이스를 추가하세요.🤖 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/provider_evidence_directory_authority.rs` around lines 11 - 17, Update the provider evidence permission regression test setup around the temporary directory to validate group-write and other-user-write independently. Add separate cases using 0o020 and 0o002 rather than relying only on 0o777, while preserving the existing permission-setting and assertion behavior for each case.
🤖 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.
Nitpick comments:
In `@src-tauri/tests/provider_evidence_directory_authority.rs`:
- Around line 11-17: Update the provider evidence permission regression test
setup around the temporary directory to validate group-write and
other-user-write independently. Add separate cases using 0o020 and 0o002 rather
than relying only on 0o777, while preserving the existing permission-setting and
assertion behavior for each case.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 5242cd6e-63c2-4aa2-8f60-c3c860c367b4
📒 Files selected for processing (2)
src-tauri/src/provider_evidence.rssrc-tauri/tests/provider_evidence_directory_authority.rs
|
@coderabbitai review |
|
|
@coderabbitai review Please review the unchanged exact head |
Rate Limit Exceeded
|
|
@coderabbitai review |
Rate Limit Exceeded
|
|
@OpenCode review current head $(git rev-parse --short HEAD). Fixed the exact macOS E0617 variadic-FFI mode argument in private evidence publication with libc::c_uint; no other behavior changed. |
Dismissing: this REQUEST_CHANGES was posted against commit acc09e1 where coverage-evidence failed. The PR's current head has coverage-evidence passing (verified via gh pr checks). No unresolved review threads remain. Re-request review to re-validate.
Purpose
Fail closed before provider synchronization evidence is created under a Unix directory writable by group or other principals. Provider evidence can later participate in source-eviction authority, so the local durable evidence root must not be replaceable or writable by unrelated principals.
Exact current state
acc09e1434985af4ac266ad60bb37dbc23882aa5.main:be418bac9bfbdc8aa41b1a698713833e3dbccfdc.main -> headcomparison isahead,ahead_by = 12,behind_by = 0, with merge base exactly equal to live protected main.src-tauri/src/provider_evidence.rsplussrc-tauri/tests/provider_evidence_directory_authority.rs.31584579943, Release31584579944, Security Scan31584579913, and SAST Semgrep31584579905all completed successfully.COMMENTEDon predecessor head66e3432f01c5e8bd16065038e5c4b8103968ecc6; its sole semantic nitpick was that a0777fixture did not independently prove group-write and other-user-write rejection. Current head addresses that exact finding with separate0o020and0o002cases. Review threads are currently empty. Predecessor review evidence does not transfer as current-head approval.Test-first repair
The regression calls production
write_immutable_sync_evidencewith valid provider evidence under two independently unsafe real temporary-directory modes:0o720); and0o702).Each case requires stable
provider-evidence-directory-writable-by-othersrefusal and zero evidence files created. The production writer rejects Unix directory mode& 0o022 != 0, creates the evidence file owner-read-only withOpenOptionsExt::mode(0o400)atcreate_new, and performs post-write hardening through the already-open file withfile.set_permissions(...)rather than re-resolving its pathname. Existing non-directory, symlink, bounded-size, create-once, fsync, and integrity behavior remains intact.Scope / non-duplication
This protects only the durable provider-evidence authority root. Protected main separately hardens private-evidence parents and other cloud boundaries. #181 owns cloud-review decisions, #182 cloud-eviction authority records, #186 cloud-copy receipts, #174 generic cleanup, #156 repository-wide exact coverage, #150 Podman desktop evidence, and #149 canonical acquisition documentation. No other active line is imported here.
Required before merge
Keep Draft until the unchanged exact head satisfies every live required workflow, repository-wide exact 100% owned-production coverage without exclusions or threshold weakening, all valid current-head findings are addressed, and fresh live-base ancestry remains current. Pending, queued, skipped-required, failed, stale, predecessor, model-only, status-only, rate-limited, or synthetic evidence is not passing.