Skip to content

fix(security): fence Root reads against root replacement - #424

Merged
steipete merged 3 commits into
mainfrom
codex/root-read-final-fence-20260915
Sep 16, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/root-read-final-fence-20260915

Conversation

@steipete

@steipete steipete commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Root reads could return data or handles from a replacement tree after the configured root was swapped. This change verifies the captured Root identity on both sides of final file admission and retains exact file identity through canonical-path checks before returning anything to the caller.

The shared descriptor-opening code is separated from Root-specific admission. Integration retains metadata observation guards and rejects Windows namespace aliases on the new final-canonicalization path before any alias lookup or read. These checks add the two root observations needed to protect the distinct admission boundaries.

The integrated package builds, 94 focused read, sidecar, and pathname-snapshot tests pass, and fresh independent review through P2 is clean. Head 54342760a4e97e23fac571f067251d676eed4d76 passed the complete CI matrix, coverage, and the Linux/macOS/Windows mutation proof, then was fast-forwarded onto main.

@steipete
steipete requested a review from a team as a code owner September 16, 2026 04:27
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 16, 2026, 5:38 AM ET / 09:38 UTC (Revision 9).

ClawSweeper review

What this changes

The branch fences Root reads against replaced directories and files, makes no-clobber moves native-backed, and preserves isolated producer handoff across Windows deletion behavior.

Merge readiness

⛔ Blocked before merge - 4 items remain

The read-fence work remains necessary on current main. No concrete introduced correctness defect was found, but current-revision behavior proof and the previously declared performance qualification remain incomplete.

Priority: P2
Reviewed head: 54342760a4e97e23fac571f067251d676eed4d76

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation and regression coverage are solid, but incomplete behavior proof and unresolved performance qualification prevent merge readiness.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: Earlier mutation evidence, current sidecar proof status, and the companion’s Windows output provide useful partial coverage. The current Root read-admission path still lacks revision-linked real output showing replacement/restoration and outside-alias rejection before bytes or handle handoff; blocked log retrieval is a separate reviewer limitation. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Earlier mutation evidence, current sidecar proof status, and the companion’s Windows output provide useful partial coverage. The current Root read-admission path still lacks revision-linked real output showing replacement/restoration and outside-alias rejection before bytes or handle handoff; blocked log retrieval is a separate reviewer limitation. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 9 items Applicable repository policy: Read the complete root AGENTS.md; no nested AGENTS.md or matching maintainer-note files were found. Applied confinement, identity, compatibility, and changelog guidance while respecting the read-only review restriction.
Current main still lacks the final read fence: Current main opens through generic local-file admission and then checks containment; this path does not recheck the captured root around final pathname and canonical-file admission.
Read admission and forbidden-path coverage: The new admission owner checks root identity, pathname identity, fresh canonical containment, canonical identity, and root identity again before returning the descriptor. Regression cases cover persistent replacement, replacement/restoration, outside aliases, contained controls, and closure before reads. These tests were inspected, not executed.
Findings None None.
Security None None.

How this fits together

Root is fs-safe’s filesystem capability: it accepts paths beneath a captured directory and returns admitted file handles or contents. The branch also changes how guarded moves and temporary producer files reach their destination.

flowchart TD
  A[Caller paths] --> B[Captured Root identity]
  B --> C[Open and verify file]
  C --> D[Recheck root and canonical target]
  D --> E[Return bytes or handle]
  D --> F[Reject and close descriptor]
  B --> G[Admit move or producer parents]
  G --> H[Atomic move or pinned handoff]
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Earlier mutation evidence, current sidecar proof status, and the companion’s Windows output provide useful partial coverage. The current Root read-admission path still lacks revision-linked real output showing replacement/restoration and outside-alias rejection before bytes or handle handoff; blocked log retrieval is a separate reviewer limitation. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P2) - Existing default Root.move calls without usable native support will now fail with helper-unavailable; isolated producer fallback also requires hard-link support. The companion discussion accepts this boundary, but consumers still need upgrade qualification.
  • Resolve merge risk (P1) - Added synchronous read observations may affect latency and event-loop occupancy; earlier revisions failed the contributor’s declared performance acceptance gates, and current-revision qualification remains unresolved.
  • Complete next step (P2) - Add current-revision read-fence behavior evidence and resolve the published performance hold. Terminal output, redacted logs, or a diagnostic recording count; redact private paths, hosts, and credentials. Update the PR body to trigger re-review, or ask a maintainer to comment @clawsweeper re-review if needed.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test growth production +990 net lines; tests +2,201 net lines Growth includes the stacked move/handoff implementation and extensive regression coverage; embedded Rust test additions are counted as tests.

Merge-risk options

Maintainer options:

  1. Complete qualification without weakening the fence (recommended)
    Resolve the declared performance hold and retain upgrade evidence for native-unavailable moves and isolated producer publication.
  2. Retain the hold
    Keep the branch unmerged if acceptable read cost cannot be demonstrated while preserving all admission observations.

Technical review

Best possible solution:

Preserve the complete read fence and accepted atomic-move contract, with demonstrated upgrade behavior and acceptable measured read cost.

Do we have a high-confidence way to reproduce the issue?

Yes, source establishes a concrete root-swap window between path resolution and file admission on main, and the branch supplies deterministic replacement/restoration regressions. This review did not execute them.

Is this the best way to solve the issue?

Yes, coupling captured-root checks with exact pathname and canonical-file identity is a focused repair; the included move changes follow the companion PR’s explicitly discussed fail-closed contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 59e85b8656ca.

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: Default no-clobber moves newly reject native-unavailable setups, and fallback producer publication requires hard-link support.

Label justifications:

  • P2: This is concrete filesystem hardening with bounded scope and no demonstrated emergency production incident.
  • merge-risk: 🚨 compatibility: Default no-clobber moves newly reject native-unavailable setups, and fallback producer publication requires hard-link support.
  • merge-risk: 🚨 availability: The synchronous read fence has an unresolved performance hold supported by failed measurements on earlier revisions.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Earlier mutation evidence, current sidecar proof status, and the companion’s Windows output provide useful partial coverage. The current Root read-admission path still lacks revision-linked real output showing replacement/restoration and outside-alias rejection before bytes or handle handoff; blocked log retrieval is a separate reviewer limitation. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Applicable repository policy: Read the complete root AGENTS.md; no nested AGENTS.md or matching maintainer-note files were found. Applied confinement, identity, compatibility, and changelog guidance while respecting the read-only review restriction. (AGENTS.md:1, 54342760a4e9)
  • Current main still lacks the final read fence: Current main opens through generic local-file admission and then checks containment; this path does not recheck the captured root around final pathname and canonical-file admission. (src/root-impl.ts:681, 59e85b8656ca)
  • Read admission and forbidden-path coverage: The new admission owner checks root identity, pathname identity, fresh canonical containment, canonical identity, and root identity again before returning the descriptor. Regression cases cover persistent replacement, replacement/restoration, outside aliases, contained controls, and closure before reads. These tests were inspected, not executed. (src/root-read-admission.ts:42, 54342760a4e9)
  • Companion implementation and explicit compatibility discussion: fix(security): make no-clobber root moves atomic #357 remains open at c6e02f3, the recorded parent of this PR head. Its discussion explicitly accepts native-required default moves and hard-link-required fallback producer handoff, and supplies Windows collision and inode-preservation output: fix(security): make no-clobber root moves atomic #357 (comment). This is stacked work, not a competing duplicate implementation. (src/root-move-noreplace.ts:90, c6e02f3c47f5)
  • Proof scope and continuity: The captured body and live body match at the pinned head and report focused tests. Earlier mutation evidence supports the design. Current-head job 104741513708 reports successful sidecar handoff/replacement proof; the inspected script exercises lock release and file replacement, not the central root-replacement/restoration and outside-alias scenarios. Raw job-log retrieval was blocked by the artifact-host allowlist; that reviewer limitation is separate from the scenario coverage gap. (scripts/sidecar-unlinked-snapshot-proof.mjs:89, 54342760a4e9)
  • Unresolved performance disposition: fix(security): fence Root reads against root replacement #424 (comment) records 474 failed performance gates and 48 unavailable cells for the earlier f62de0b revision. No subsequent supplied or live human comment resolves that hold for the current revision. These figures are historical measurements, not measurements of the current head. (f62de0babf31)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Provide revision-linked real output showing root replacement/restoration and outside-alias rejection, descriptor closure, and successful contained controls.
  • Resolve the declared complete source/control performance acceptance requirement without weakening the fence.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (8 earlier review cycles)
  • reviewed 2026-09-16T04:30:21.157Z sha bdca904 :: needs real behavior proof before merge. :: [P2] Reconcile the read syscall budget with the added fence
  • reviewed 2026-09-16T04:58:31.532Z sha 1026a46 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-16T05:10:08.724Z sha 1026a46 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-16T05:27:17.898Z sha 1026a46 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-16T05:52:09.425Z sha 09d7eea :: needs real behavior proof before merge. :: [P2] [P2] Keep the expanded files within the enforced size budgets
  • reviewed 2026-09-16T06:09:50.903Z sha f62de0b :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-16T06:19:37.076Z sha f62de0b :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-16T06:28:47.225Z sha f62de0b :: needs real behavior proof before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

Exact fail-before proof independently audited by GPT-6 Astra xhigh: ACCEPT.

  • candidate 1026a460… / tree 900d03ec…: run 35057438717, 15 active jobs passed
  • base-production mutant 44fc4713… / tree 929412bc…: run 35057564929, 10 target jobs failed; src/native exactly base and all nonproduction content exactly candidate
  • root-only mutant b4adbb7… / tree 1fde3a45…: run 35057566501, 10 target jobs failed; both root checks/hooks remain, but coupled final pathname/canonical identity is bypassed
  • no unrelated failures; 249 target test executions failed under base production and 213 under root-only

The root-only mutant is decisive: restored-root and outside-alias cases return replacement bytes while persistent/tail root checks and unchanged controls pass. The final-stage sidecar suite also discriminates permitted exact-unlink recovery from linked/unknown/changed descriptors, ordinary Root reads, and changed ancestry. Candidate Windows Node 24 contention now passes 100/100 root-async acquisitions and 400/400 overall.

Coverage and strict paired performance evidence remain pending, so this is not yet a merge decision.

@steipete

Copy link
Copy Markdown
Contributor Author

Performance HOLD for exact head 1026a460359760ab28269331c092afc20bf869b6 / tree 900d03ece1872d3ab0188b8f288d47f5cd37400a.

Fresh independent GPT-6 Astra xhigh audits verified exact provenance and recomputed all raw gates:

  • Root.open: 267/288 source and 78/288 control failures
  • Root.read: 211/288 source and 70/288 control failures
  • cached reader: 206/288 source and 66/288 control failures
  • total: 684/864 source, 214/864 controls, 898/1,728 overall

All 36,288 raw samples were retained; controls and orders stayed independent, with no subtraction, exclusions, cross-order pooling, or selective reruns. Exact coverage attempt 2 passed all platforms and merged coverage.

Do not merge this head. I am evaluating Astra's phase-fusion design to remove three duplicate filesystem observations while preserving the full final security fence. A replacement must repeat exact review, proof, CI, coverage, and performance evidence.

@steipete

Copy link
Copy Markdown
Contributor Author

Performance remains a hard HOLD after phase fusion.

A fresh independent GPT-6 Astra xhigh audit of exact head 09d7eea89aa93d32474ff0905694c0f2929abd25 verified all 60 artifacts, provenance receipts, 36,288 raw samples, and all 1,728 independent gates. The optimization reduced failures from 898 to 445, but did not meet the zero-failure policy:

  • Root.open: 68 source + 32 control = 100/576
  • Root.read: 73 source + 91 control = 164/576
  • cached reader: 82 source + 99 control = 181/576
  • total: 223 source + 222 control = 445/1,728

A separate Astra design consultation found no safely redundant final-fence observation: both pathname checks and both root checks protect distinct phases. I will not remove or merge around those guarantees.

The current head f62de0babf3165bd50003c3398370d74a5059158 contains only an Astra-accepted no-behavior file split required by CI file-size limits. Because exact-head evidence is mandatory, a complete new 12-run ABBA/BAAB source/control study is underway and linked in the PR body. No prior performance result will be reused as final proof.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Sep 16, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Exact-head performance verdict: HOLD / FAIL.

A fresh independent GPT-6 Astra xhigh audit of head f62de0babf3165bd50003c3398370d74a5059158 verified all available artifact digests, source/harness identities, plans, seals, reconstructed receipts, snapshots, bindings, chronology, and raw aggregates.

  • source: 293/864 failed
  • available same-artifact controls: 181/816 failed
  • total: 474 failed, 1,206 passed, 48 unavailable

The unavailable cells are the macOS cached-reader control BAAB slice in run 35062487785. Measurement succeeded, but artifact upload failed with HTTP 403; rounded logs cannot recover the raw samples. I am recording that as incomplete evidence and will not selectively rerun, substitute, or exclude it.

This is independently red even before the missing cells. Both root observations and both pathname observations protect distinct phases, so the PR remains open and unmerged rather than weakening the fence.

Make no-clobber Root moves atomic through native rename primitives and preserve identity-pinned isolated producer handoff, including legacy Windows delete-pending behavior.
Keep boundary error codes and details primary when Windows descriptor disposal also fails. Retain combined-error behavior on POSIX and cover both root and parent admission with real closed-descriptor checks.
Fence Root reads against replacement of the captured root and final path, rejecting swapped trees before returning file contents or handles.
@steipete
steipete force-pushed the codex/root-read-final-fence-20260915 branch from f62de0b to 5434276 Compare September 16, 2026 09:32
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. label Sep 16, 2026
@steipete
steipete merged commit 5434276 into main Sep 16, 2026
34 of 35 checks passed
@vincentkoc
vincentkoc deleted the codex/root-read-final-fence-20260915 branch September 25, 2026 11:15

This branch was previously deployed

1 inactive deployment
github-pages — 54342760 Deployed Sep 16, 2026 by steipete via Deploy docs #265
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant