Repository navigation
Own sandbox M1: cua's seatbelt port and own host on macOS (#115) - #156
Merged
Merged
Conversation
…nal's policy files src/sandbox/seatbelt.mjs ports the original codex sandbox's profile generation at rust-v0.159.2 for cua's input set and matches the 20 golden fixtures byte for byte (numeric TIOCSTI), on an in-memory macOS-shaped filesystem everywhere and on the real one on a Mac. Recorded deviations: no Codex config, the numeric TIOCSTI line, one more stripped name, a relative TMPDIR refused, and a metadata grant on the denied directories above re-exposed paths (without it Node cannot resolve a module under a re-exposed directory: lstat of the denied ancestor fails with EPERM).
… asks for src/sandbox/policy.mjs renders one permission profile per role from a call's sandbox state (the CLI's key order, through sandboxPolicy's validation), adds the kernel's deny list (the secret store with the real targets of symlinked tiers, ~/.config/cua, the whole cua home on macOS with runtimes/, node/ and the session re-exposed; Linux's per-directory shape from M0c), creates missing deny targets 0700 before rendering, and keeps one launch key for both roles. src/sandbox/index.mjs turns a role and state into the sandbox-exec launch.
…ua's sandbox buildLaunch gives every launch its session's own TMPDIR (run/<id>/tmp, both hosts), resolves the kernel's deny list once into CUA_SANDBOX_DENY_READ, trusts src/sandbox on both hosts, and on macOS gives cua's own host CUA_REPL_SANDBOX_EXEC instead of CODEX_CLI_PATH and CODEX_HOME (Linux keeps the Codex CLI until M3). The supervisor launches each child by role through src/sandbox under sandbox-exec, which execs Node, keeps one launch key for both roles and refuses with a sentence when the deny list is missing or malformed, a deny target cannot be created or a state cannot be rendered. The scoped preflight and doctor protect the deny list except the launch's own run directory and session temp. The tz probe's cua launcher and the oracle's fingerprint under cua's launcher and port-vs-capture are wired.
…er its own sandbox scripts/accept/own-sandbox.mjs opens real own-host connections (browser surface only: no helper, no GUI) on an installed home and checks, per mode, every deny-list location (store, symlinked tier target, ~/.config/cua, state/, an enrolled device under remote/, chrome/, another session's run directory), the module tree, writes, a hard link and a clone of a denied file, TCP and AF_UNIX connects, the kernel's process and the absence of codex. Synthetic sentinels only, removed after; the report carries labels and codes.
…e's run/ is the run's Since M1 buildLaunch gives every launch its session's own TMPDIR, so the native helper a run opens carries <home>/run/<session>/tmp rather than the run's own TMPDIR. During the run the approved home's run/ is the run's (moved aside, the admission keeps everyone else out, and preparation refuses while the helper runs), so that value is as causal a witness; the run's own TMPDIR stays accepted for pre-M1 runs (M0c's obligation before M2's native runs).
… rules mini-rules gains `gated -- <command>` (the gate, the command, the frontmost check) for any mini run beyond M0's items. scripts/sandbox-probe/m1-mini.sh carries M1's: the oracles (fingerprint under cua's launcher, port against the argv captures), the own-host confinement check, and the cfprefsd measurement (cells and services under log stream before and after, reduced by denials.mjs so no account path leaves the mini). accept-native gains item 11, the own-host confinement check.
…s the boundary launch's TMPDIR; the overlap preflight stages a run directory resolving into the modules
…ystem prompt always stops, and Terminal is required once the runner is idle
… own host at 96104bc (150/150, confinement and lifecycle included)
…l=9) by Node itself against the vendor's exited(code=137) on macOS child-exit-settles only (#115 M1, retired in M2)
…ome and its run/, literal and metadata only, real paths, never the store, ~/.config/cua or another session); the kernel fingerprint pins it too
…targets refused in scoped and default; the run directory's exception only for its own home; the port grants metadata only within the launch's metadataOnly
…exit 1; fingerprint comparisons judged against declared deviations; port-vs-capture fails beyond its deviations
…r discovers the deny list; confined launches keep strict discovery, and a list-less host refuses every confined call
…kernel exit facts on child-exit-settles; the rest of that row compares
…s; a disabled connection builds no list
…wo TextEdit runs back to back
…e parity comparator's own field set (ok, error, proof included)
… an unread CI observation waits and reads again, an unreadable frontmost app still stops
…IR witness), the own-host browser triple, and tz under the real HOME (0 of 160 hung)
… residue runs done
…d port-vs-capture, every judgement ok), gated under load < 5
…ate (the file did not parse, so accept-native crashed on load); every acceptance script is now syntax-checked and accept-native's imports loaded by the unit suite
…s PASS, 0 FAIL (the 107c291 attempt stopped on own-sandbox.mjs's parse error)
…nthetic key): FAIL (npm test 2 of 2586 and its cascade; item 10's clean clone of a detached checkout), items 4-5 PASS; the run left its TextEdit in front (stop at 15:25:44Z)
…TextEdit stop, per-item results, item 1's two failing tests, item 10's matches by file:line and rule)
…1 PASS (71/71); live probe-secrets' store-unreadable phase meets M1's launch refusal; the README with the 107c291/c55ba01 split
…ceeds with the store denied (only a searchable, unlistable one refuses); three M0/M1 tests hold under accept-native's env -i item-1 environment
…me entry symlinked out of it (but runtimes/ and node/); a host read path inside a deny target, outside the re-exposures, refuses the kernel launch; the worker probe runs under sh whatever the login shell; m1-mini accepts only hex commit ids; the launcher double quotes its paths
…d/diagnosticd noted; the pause artefact)
…g from kernel cells for M4's notes
…it timer: a refused launch exited 0 by natural exit before the timer fired (cua serve itself exits 1); a child-process test for both against an unreadable store
…4bfece proceeds (projects/ absent; 0 tiers), kept as attempt 2 ahead of the rerun at the new final SHA
…al store; oracles every judgement ok; own-sandbox 76/76 PASS, the store root missing at launch kept denied (plain and through a symlinked ~/.config)
…, oracles, own-sandbox 76/76; cfprefs attempt 2's sandbox_conflict in the parity layout)
…ended it at 18:34:34Z on two Runner.Workers, 37 s into the before side; its own leftovers cleaned
…the controller at 18:48Z for the worker-probe fix; its own tree ended, leftovers cleaned
… the hook paused it correctly at 19:02:06Z on a real CI job, and the controller-side watch wrongly ended it at 19:03:39Z (its long-cell test missed a pause line logged before the watch first saw the pause)
…dle throughout): before 150/150 and 41/41 PASS; after side still sandbox_conflict, since the after side's remote serve-cells capability home is 5d9bf70's own, which nests HOME
…e securityd crash correlation (1 of 5 crashes overlaps a run of ours; one stack in all)
…sandbox kept as attempts ahead of the rerun at f8019bf
…every judgement ok; own-sandbox 76/76 PASS
…ites PASS, no preferences denial; new diagnosticd/logd mach-lookup denials on the after side; the cells judge's one difference is the 34-minute pause outlasting the runtime's idle stop
…agnosticd stay denied, noted; the suspend-resume difference is a pause artefact)
…ASS; the cua side's attempt 1 ended at the controller's ruling during a 34-job CI burst (kept, invalid)
…I-opt's hold (queue exception), diff ok with no undeclared difference; suspend-resume closed
… with item 11 (76/76 PASS) against main's items; parity's README section; one live finding (a refused launch exits 0)
…dbox 76/76 PASS; probe-secrets standalone PASS, the refused launch now fails closed with a failing exit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #115: M1 of the own-sandbox spec (
docs/doperpowers/specs/2026-10-17-own-sandbox-design.md). On macOS, cua's own REPL host now launches its kernel and trusted worker under cua's own seatbelt profiles, generated bysrc/sandbox/, a JavaScript port of openai/codex rust-v0.159.2's profile generation (Apache-2.0, with provenance headers, LICENSE and NOTICE). No Codex CLI process is involved on that path any more. The kernel is denied the secret store,~/.config/cuaand the cua home;runtimes/,node/and its own run directory stay re-exposed. TMPDIR is per session. The vendor host and Linux keep the Codex CLI until M2 and M3.The live mini acceptance ran at code f8019bf, and its evidence branch is merged here. reviewer-high returned correct after one fix round (f8019bf). A later harness-only fix (6ad675c) makes probe serve wrappers keep their exit status.
What changed
src/sandbox/:policy.mjs(roles, deny list,prepareDenyTargets),seatbelt.mjs(the port),env.mjs,index.mjs, the four.sbplfiles as byte copies, LICENSE and NOTICE.src/runtime/launch.mjs: the deny list andCUA_SANDBOX_DENY_READ({deny, reexpose, metadataOnly, tiers}), the per-sessionsessionTmp, andsrc/sandbox/added to the trusted code paths. The macOS own host no longer gets CODEX_CLI_PATH or CODEX_HOME. Adisabledconnection builds no list.src/runtime/sandbox.mjs: overlapping deny targets are refused (sandbox_conflict), and only the launch's own run directory and session temp are excepted.src/repl-host/supervisor.mjsandkernel-child.mjs:childLaunchby role, a launch key equal for both roles, and the kernel is Node itself under/usr/bin/sandbox-exec.own-sandboxacceptance item 11. Also:scripts/mini-rules.mjs);scripts/mini-pause.mjs, MAWS DL 58), with aRunner.Workerprobe matched by executable;kernel-exit-statusdifference, retired in M2.Rulings and deviations (spec Decision Log)
file-read-metadataon exactly<cuahome>and<cuahome>/run, as literals at real paths. Without it, Node's ancestorlstatmakes every import fail. The other deviations are all tighter or fixes: no Codex config, the numeric TIOCSTI, one more stripped env name, and a relative TMPDIR is refused.projects/refuses with a sentence naming the remedy. A relaxation tried first was reversed after review, because the kernel could still read an external tier through its real path.realishpath and creates nothing.sandbox_conflictwhen the cua home, the store or its tiers, or~/.config/cualie inside one another. Remedy: move them apart, or rundisabled.Validation Evidence
HOME=$(mktemp -d) npm testat 7525181 (after merging main):# tests 2800,# pass 2629,# fail 2,# skipped 169.create-hetzner.sh copies an upload whose local path has a space …is the knownprintf: write error: Broken pipe, which fails the same way at base.macOS: a 192-byte socket path connects …is a flake under full-suite load on this shared MacBook, and passes alone. CI is the gate of record.npm run test:mods: 133 tests across 6 files, 0 failed.claude plugin validate .: passed, with the known pre-existing warnings.docs/evidence/2026-10-17-own-sandbox/m1/gce-cua-cells/).docs/evidence/2026-10-17-own-sandbox/m1/, with earlier attempts kept as*-attempt-N/and their causes:own-sandbox(acceptance 1–5): 76/76, including store-root-missing-at-launch, which stays denied once created;logd/diagnosticdmach-lookup denials are noted, not granted;diff --expectedok, with 0 undeclared differences;Unresolved Review Findings
docs/doperpowers/research/2026-10-17-own-sandbox/spike-helper/serve-spike.mjs:13: the archived research wrapper still exits only through an unreferenced timer, the pattern 6ad675c fixed in the maintained wrappers. Left as is: it is a research artefact that nothing runs.test/sandbox/reexposed.test.mjs:143-152: waits 300 ms before creating the store, instead of a readiness handshake with the sandboxed child. Under heavy load the mid-session proof weakens. Left: the acceptance runner's own check uses a warm-cell handshake.test/native-baseline/device.test.mjs:163,167(from M0): a temp path is interpolated intosh -csource. Test-only.Residue
env -ienvironment. Not Independence 2: cua's own sandbox for node_repl cells; drop the Codex binary and app-server #115's scope.