Repository navigation
Send node_repl the disabled sandbox state on every runtime call (CUA_SHIM_SANDBOX) - #22
Merged
Merged
Conversation
…SHIM_SANDBOX)
cua serve now attaches _meta["codex/sandbox-state-meta"] = {permissionProfile: {type: disabled}, sandboxCwd: <file
URI of the launch directory>} to js, js_reset and the private turn_ended, and the bounded listing launch behind
cua profiles list/bind and profiles_list sends the same. A client's own entry under that key is replaced or dropped.
CUA_SHIM_SANDBOX=default sends nothing (node_repl's write-denying default). node_repl rejects the field without
sandboxCwd, so it is always sent with the launch's working directory.
README configuration row and paragraph; spec Decision Log entry with the owner's decision and live results.
…diness Review finding: the setting was validated inside the listing callback, which profileReadiness folds into a listingError, so profiles list reported ok with an invalid setting. The CLI now validates it for list and bind first.
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.
What
cua servenow sends node_repl's per-call sandbox state,_meta["codex/sandbox-state-meta"], on every call it makes to the runtime:js,js_resetand the privateturn_ended. The bounded listing launch behindcua profiles list/bindandprofiles_listsends it too. That launch does go through a node_repltools/call(jswith the liveness/list cell).CUA_SHIM_SANDBOX(parsed insettingsFrom; the listing launch reads the same variable):disabled(default) sends{"permissionProfile":{"type":"disabled"},"sandboxCwd":"<file URI of the launch's working directory>"}.defaultsends nothing (the previous behaviour).invalid_setting._meta["codex/sandbox-state-meta"]never reaches the runtime. It is replaced underdisabledand dropped underdefault.src/runtime/sandbox.mjs.Deviation from the ticket's literal payload
node_repl rejects
{"permissionProfile":{"type":"disabled"}}on its own:-32602 js: codex/sandbox-state-meta: missing field 'sandboxCwd'. It requires an absolutefile:URI there. Spike #8's working payload also carriedsandboxCwd. cua therefore sends the launch's own working directory as a URI (pathToFileURL, percent-encoded; accepted live).useLegacyLandlockhas a default and is omitted.Measured beyond the decision's wording
The disabled profile also lifts node_repl's network denial:
disabledReachability was not established. This is recorded in the README and the Decision Log.
Tests (written first)
test/mcp-sandbox.test.mjscovers:default, rejected values;js/js_reset/turn_endedcarry the state, and carry nothing underdefault;_metais kept.test/profiles-inventory.test.mjs: the listing cell carries the given state, or none.test/serve-cli.test.mjs, end to end throughbin/cua.mjs servewith the fake runtime:sandboxCwdequal to the session directory onjsandturn_ended;profiles_listlisting launch sends it for its own directory;CUA_SHIM_SANDBOX=defaultsends none onjs/js_reset/turn_ended;cua profiles list(plain and--json) andbindexit nonzero withinvalid_settingon an invalid value, before any listing launch.npm test: 414/414 pass.Review
doperpowers:reviewer-mediumreturned one P2 finding and found no P0 or P1 issues. The finding:cua profiles listvalidatedCUA_SHIM_SANDBOXinside the listing callback.profileReadinessfolds a failure there intolistingError, so an invalid value producedok: true. Fixed in 88ba2bc: the CLI now validates the setting forlistandbindfirst. A regression test covers it.Live results (this Mac, default
CUA_HOME, read-only, nothing bound or picked)node bin/cua.mjs profiles list --jsonfrom the worktree reportedpersonalandschoolready andworkwithextension_not_installed, the same as before.listLiveBackendscallprofiles listmakes, printing only whether a label was present (never the label itself):CUA_SHIM_SANDBOX=default: none labelled.codex*temp leftovers were found.CUA_SHIM_SURFACES=computer node verify.mjs: green (problems: [], task ended, repeat end a no-op, next task differs, exit 0).cua serve: a driver ran one connection with a cell that writes a file inos.tmpdir()and reads it back, thenjs_reset,end_taskand EOF. No app was bound and no elicitations came up.WRITE ok.js_resetok,end_taskended, serve exit 0. The temp file was removed.CUA_SHIM_SANDBOX=default:WRITE failed: EPERM.js_resetok,end_taskended, serve exit 0.Not covered
Milestone probe scripts under
scripts/probe*andscripts/probe/chrome/launch the runtime directly and still send no sandbox state. They are historical spikes, not product launches. Downloads (the issue's suggested second check) were not exercised.Closes #20