Repository navigation
fix(security): verify temp workspace creation roots - #373
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed September 16, 2026, 5:05 AM ET / 09:05 UTC (Revision 23). ClawSweeper reviewWhat this changesThe PR verifies temporary-workspace roots and children before use, binds permission changes and cleanup to retained directory identities, and updates regression coverage, documentation, and a lock-test fixture. Merge readiness⛔ Blocked before merge - 6 items remain Keep open: current main and v0.12.0 still contain the unsafe permission-change sequence this PR addresses. The stricter contract has explicit approval, and this review found no new actionable correctness defect. Priority: P2 Review scores
Verification
How this fits togetherfs-safe creates temporary directories for Node.js applications from caller-supplied roots and permission options. Its admission checks determine which directories may be used, have permissions initialized, and acquire cleanup authority. flowchart TD
A[Caller root and options] --> B[Verify root and ancestry]
B --> C[Create unique child]
C --> D[Retain and verify child identity]
D --> E[Initialize permissions through descriptor]
E --> F[Revalidate before adoption]
F --> G[Workspace and guarded cleanup]
B --> H[Reject unsafe state]
D --> H
F --> H
Before merge
Findings
Agent review detailsSecurityNeeds attention: No concrete bypass or supply-chain regression was found, but the material permission and cleanup-authority handoff still requires final-effect proof. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Preserve the approved descriptor-bound admission design, with demonstrated fresh and existing-root safety, replacement preservation, and acceptable creation latency. Do we have a high-confidence way to reproduce the issue? Yes, from source: both main factories change directory permissions by pathname before establishing child identity, and supplied-root modes are rewritten. No runtime reproduction was executed during this read-only review. Is this the best way to solve the issue? Yes in direction: retained descriptors and explicit admission address the unsafe sequence, and the compatibility change is approved. Final acceptance still depends on the recorded authority and performance evidence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5108b3bb6250. LabelsLabel 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 (22 earlier review cycles; latest 8 shown)
|
|
Performance gate update (exact head
The macOS native-required sync result trips this PR's declared ≥2× investigation threshold. I am holding the PR and consulting a fresh Astra performance-design challenger to reduce redundant metadata/realpath passes without weakening fail-closed admission. These remote results are not a merge approval. Windows was still running when captured. |
4e998a0 to
fd2d2a1
Compare
|
Performance repair update:
Exact base/head cross-platform measurement is now running at https://github.com/openclaw/fs-safe/actions/runs/34914744914 (50 iterations × 7 samples). The PR remains held until exact-head CI, real unprivileged behavior proof, and measured recovery clear. |
|
Exact optimized-head audit fd2d2a1 (20x7, run 34914744914) still fails the latency gate despite lower source-level observation counts. Ubuntu: async creation improved -17.84%/-24.29% (off/require), but sync regressed +45.46%/+36.30%; mode-correction regressed +76% to +111%. macOS: async +37.56%/+20.91%, sync +124.80%/+81.16%, mode-correction +101.94% to +202.57%. Windows native-off: async +134.42%, sync +203.17% (native-required sweep timed out). Ranges are generally non-overlapping. Merge remains blocked. Astra is re-evaluating the architecture from the exact samples; no performance claim will be made from call counts alone. |
|
Correction to the preceding evidence note: the method JSON records 50 iterations and 7 samples per row, not 20x7. The medians, ranges, and percentages quoted there are unchanged. |
|
Maintainer decision: approve the stricter POSIX temp-workspace admission contract, conditional on the current-head authority proof and performance gates. Rejection of foreign-owned roots, non-sticky writable ancestry, writable workspace modes, and restrictive modes that cannot support bounded owner cleanup is intentional. Permission correction must target the verified new child descriptor; ambiguous or replaced roots/children must remain untouched and must not acquire cleanup authority. Existing callers should supply an effectively owned root with safe ancestry and a mode that permits the documented bounded cleanup, or explicitly choose another compliant root; the implementation must not regain compatibility through an unsafe pathname chmod or cleanup fallback. Landing remains held until unprivileged built-public-API evidence covers both factories, fresh and existing roots, real mode correction, unsafe-root/ancestor rejection without mutation, and replacement preservation, and until exact-head comparative performance clears. |
Admit temporary-workspace roots and children before use, preserve existing permissions, and bind mode initialization and cleanup to retained directory identities.
6feef15 to
e2261bc
Compare
Keep real sidecar acquisition and draining outside the wrapper-construction timeout. Track setup and test completion so fixture removal cannot race timed-out filesystem work.
Temporary-workspace creation previously changed directory permissions by pathname before establishing trustworthy ownership. This change admits the root and its ancestry, preserves existing directory permissions, and binds child mode initialization and cleanup to retained identities and descriptors.
Admission stays current through creation and final adoption. Unsafe or ambiguous ownership states fail closed; bounded cleanup keeps its explicit capability requirement. Integration preserves Windows namespace handling, captured caller options, and the directory observation helpers introduced by the earlier security fixes.
The integrated package builds and its focused creation, permission, cleanup, namespace, and observation suites pass: 323 tests, with 81 platform/native skips. Fresh independent review through P2 found no actionable issue. Public workspace types were separated from lifecycle code to retain the existing file-size budget. Head
59e85b8656ca9deb5621c94086d8fb02a22d74b9passed the complete CI matrix and was fast-forwarded onto main. An unrelated Windows ACL-command check passed unchanged on a targeted retry; its first execution took 30.3 seconds, matching the external-command timeout.The first Windows Node 22 run exposed an unrelated retained-lock fixture timeout. Setup and drain now use the existing suite-fixture lifecycle and separate hook budgets; the wrapper assertion keeps its five-second budget. Both focused fixture suites pass (8 tests), and the CI fix received independent review through P2.