Repository navigation
fix(store): consolidate mutation guards - #107
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 2, 2026, 8:15 PM ET / August 3, 2026, 00:15 UTC. ClawSweeper reviewWhat this changesThe PR unifies synchronous file-store directory guards, pins the original root identity during parent creation, and reuses the shared existing-ancestor canonicalizer for mutation-deny comparisons. Merge readiness⛔ Blocked until real behavior proof is added - 4 items remain Keep this PR open: it addresses a concrete synchronous store-root swap weakness with a focused consolidation, but the available review evidence lacks inspectable after-fix runtime proof and one Windows Node 24 check is failing. No discrete correctness defect is evident in the submitted diff from source review, so the next step is to diagnose that platform result and provide redacted real-run evidence before merge. Priority: P1 Review scores
Verification
How this fits togetherThe synchronous file-store layer creates and validates parent directories before writing beneath a caller-configured root. It receives attacker-controlled relative paths and filesystem metadata, then either returns a verified parent guard or rejects symlink, root-swap, and workspace-escape conditions. flowchart LR
A[Store write request] --> B[Resolve store root and target]
B --> C[Pin canonical root and identity]
C --> D[Walk or create parent segments]
D --> E[Revalidate root and segment paths]
E --> F[Verified parent guard]
F --> G[Write file or reject unsafe path]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Preserve the shared pinned-root guard, repair or explain the Windows-specific check failure, and add redacted after-fix terminal evidence showing both store modes reject a root swap without writing outside the configured root. Do we have a high-confidence way to reproduce the issue? Yes, from source: the added focused test defines a concrete root rename-and-symlink swap during the synchronous parent walk, and current main lacks the branch's per-segment root identity revalidation. This review did not execute it because the target checkout is read-only. Is this the best way to solve the issue? Yes, conditionally: using one guard for both synchronous store modes removes the divergent implementation while preserving the existing guarded-helper boundary. The Windows check must be resolved before that solution can be accepted as cross-platform safe. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 947fa83fd43e. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Summary
Investigation corrections
The divergent store walker was a live root-swap bug, but the vulnerable side was the private walker: recomputing the root realpath after a redirect followed the replacement and accepted it. The non-private walker's hoisted canonical root already rejected that redirect. The shared implementation is stricter than both because it pins the original canonical path and inode and revalidates them per segment.
The two ancestor-loop predicates were behaviorally equivalent for the reported Windows spellings after their common path resolution step. This PR still removes the duplicate implementation and adds a native-Windows table for drive-relative, device-root, and UNC spellings so future drift is impossible, but does not claim a Windows behavior change.
Proof
Production source is reduced by 41 lines; including focused regressions and the changelog, the net change is +32 lines.