security: bind private evidence publication to directory identity - #228
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 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 증거 저장 로직이 경로 기반 생성에서 디렉터리 디스크립터와 ChangesUnix 증거 파일 생성
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: 🟡 Moderate · up to Private evidence creation can fail under some umask settings after leaving a zero-byte file, which can block retries at the same path. The file mode must be enforced and the failure path addressed before this change is merge-ready. Sequence Diagram(s)sequenceDiagram
participant 저장 함수
participant 부모 디렉터리
participant openat
participant 증거 파일
저장 함수->>부모 디렉터리: 권한 및 device/inode 검증
저장 함수->>openat: O_EXCL, O_NOFOLLOW, 0600으로 생성
openat-->>증거 파일: 열린 파일 반환
저장 함수->>증거 파일: 동기화 및 최종 객체 검증
저장 함수->>부모 디렉터리: 디렉터리 동기화
🚥 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.
|
|
Marked ready at exact head |
Pull request was converted to draft
|
@OpenCode review current head |
eedee5e
into
security/brew-cleanup-audit-private-authority-v1
Purpose
Bind the shared
private_evidencecreate-once writer to the exact private directory object that was authorized, rather than to a pathname that a same-user actor can replace after validation.Exact current state
8d1733849884bc517171e44065e1219568120e6618c99bc131965422c01011bc8949ccca120a1d59src-tauri/src/private_evidence.rsplussrc-tauri/tests/private_evidence_umask.rs32320053074and Release32320053258are queued; predecessor evidence does not transferTest-first security repair
The implementation opens the authorized parent with Unix no-follow directory semantics; validates opened-directory device/inode identity and private permissions against the current pathname before creation, after the deterministic pre-create seam, and before success; creates the record descriptor-relative with
openat(O_CREAT | O_EXCL | O_NOFOLLOW); normalizes the already-opened record to exact mode0600so restrictive umasks cannot create a permanent unreadable tombstone; writes/fsyncs the exact file descriptor and fsyncs the opened parent; and verifies final parent and returned-path record identity against the opened objects.On post-create publication failure it does not unlink by pathname, because a same-user process may already have replaced that name. It truncates and syncs only the exact open record descriptor, leaving at most a zero-length mode-0600 tombstone in the authorized directory for explicit cleanup. Source-root exclusion, size bounds, create-new semantics, privacy flags, SHA-256 receipt, and explicit non-Unix fail-closed behavior remain intact.
The branch was advanced non-destructively onto current #187. Current base-to-head comparison proves protected-main package movement did not leak into this security edge.
Required before merge
Keep Draft until the unchanged exact head passes every applicable native and central workflow, exact repository-wide 100% owned-production coverage, zero valid unresolved findings, current stack/base ancestry, package/SBOM/provenance requirements where applicable, and live independent-review governance. Pending, queued, skipped-required, cancelled, absent, neutral-required, failed, stale, predecessor, synthetic, status-only, model-only, diagnostic-only, or author-only evidence is non-passing.