Repository navigation
fix(root): confine overwrite move in require mode - #750
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. Reviewed September 28, 2026, 10:37 AM ET / 14:37 UTC (Revision 7). ClawSweeper reviewWhat this changesRoot.move uses retained parent handles and a native identity-checked replacement rename for overwrite moves in required-native mode, with platform and integration tests. Merge readiness⛔ Blocked before merge - 11 items remain Keep open. Current main and the latest release still use a pathname rename for overwrite moves, so the security fix remains useful. The proposed required-mode contract needs maintainer approval because it can change existing move outcomes, and the final POSIX source-reassignment interval remains unproven. Priority: P0 Review scores
Verification
How this fits togetherA Root handle accepts paths relative to an approved filesystem directory, applies mutation policy, and dispatches a move. The move path selects a native or Node rename and then reports the result to the caller. flowchart LR
A[Relative move request] --> B[Root and mutation policy]
B --> C{Required native overwrite?}
C -->|Yes| D[Retained parent admission]
C -->|No| E[Existing move route]
D --> F[Native replacement rename]
E --> G[Caller result]
F --> G
Decision needed
Why: The choice changes a public safety and compatibility contract; the PR body describes the tradeoffs, but no recorded maintainer decision accepts them. Before merge
Findings
Agent review detailsSecurityNeeds attention: Retained parents improve confinement, but POSIX source identity is checked separately from the final replacement rename. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Define an approved strict overwrite contract that confines parent mutations, preserves a deliberate upgrade path for existing users, and states the POSIX source-name limit and performance cost in user-facing documentation. Do we have a high-confidence way to reproduce the issue? No deterministic current-main race was run. Current source shows the pathname overwrite after parent admission, establishing the check-to-rename window. Is this the best way to solve the issue? No, not yet. Retained-parent renaming improves confinement, but the upgrade outcome and precise source-identity guarantee need an approved, tested contract. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c4912a5d9a81. LabelsLabel changes: No label changes. Label justifications:
EvidenceSecurity concerns:
What 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
HistoryReview history (6 earlier review cycles)
|
7842167 to
d80a513
Compare
Required-native overwrite move previously dispatched Node pathname rename after parent checks. It now retains both parents, verifies the source against its admitted identity, performs descriptor-relative replacement rename on POSIX or handle-relative FileRenameInfoEx on Windows, then verifies the destination and parents. Original source/target route checks around authority callbacks and the existing no-clobber contract remain intact.
The hardened overwrite path applies only to require; default auto keeps its previous best-effort behavior. Missing required capability fails with helper-unavailable, and a configuration change during asynchronous admission cannot downgrade the captured requirement. POSIX rename is not an expected-inode conditional operation; guarded platforms retain their existing best-effort labels. See #752 for the matrix and compatibility notes.
The Windows directory-replacement test accepts the OS-supported result: successful replacement must preserve the source directory identity and contents, while a rejected replacement must leave the trees intact. No CHANGELOG changes are included.
Validation: current-head CI is green (38 passing checks, seven skips), including full checks and native lanes; focused tests, git diff --check, and independent Codex TOCTOU review through P2 passed. The combined final runtime completed 60 x 20-second strict campaigns per platform/configuration with zero outside/denied effects and complete supported-operation coverage: Linux openat2 1,012,000 calls; forced fallback 966,990; macOS 711,310; Windows 133,858. Recursive directories were explicitly tested fail-closed where unsupported. Append creation uses a unique basename per attempt. The final timing sweep uses recorded 0-8 ms hostile/restored intervals; earlier faster incomplete campaigns are retained and are not called passing.
Proof: Linux, macOS/Windows. Platform best-effort labels and namespace limitations remain as documented.
Paired Linux method benchmark, same binary with A/A controls and interleaving: required overwrite move 428.49 -> 559.18 us/call; auto overwrite move 427.94 -> 414.42 us/call, within observed variation. Required-mode admission cost is intentional; default auto retains its existing path.
Performance evidence: paired method run, warmed auto control. The proof-only follow-ups change the harness/workflow; production src/native bytes match the measured runtime.