feat(cli): sandbox public agents and isolate MCP credentials#750
Merged
Conversation
This was referenced Jul 25, 2026
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.
Summary
--ignore-user-config --ignore-rules, no legacy--sandbox, network disabled, and a minimal shell environmentCODEX_HOMEso pre-sandbox host instruction discovery cannot read the operator'sAGENTS.md; onlyauth.jsonis linked backcm_agent_*values out of Codex argv and pass them only to declared MCP servers throughenv_varsSecurity model
Public Codex wrappers opt in with:
{ "sandbox": { "mode": "workspace", "trust": "public" } }The adapter emits the current Codex permission-profile form:
Load-bearing details:
:minimal=read; only:workspace_rootsis writable~/.commonly,~/.claude,~/.codex,~/.ssh,~/.aws,~/.config,/private/tmp, workspace.commonly/**/.codex/**, and bounded.envpatterns are denied/**deny globs: exact child-directory deny entries abort Linux bwrap policy setup when those directories already exist--sandbox workspace-writeis absent because it protects integrity, not host confidentiality, and disables permission-profile composition--dangerously-bypass-approvals-and-sandboxremains only for existing internal/container wrappersAttack proof — macOS and Linux / Codex 0.144.1
Harness:
The harness requires the literal attack commands and a non-empty MCP capture, so narrative-only compliance cannot pass. It creates only random synthetic canaries and removes them in
finally.macOS Seatbelt
cat ~/.commonly/<synthetic-canary>Operation not permittedcat ~/.ssh/<synthetic-canary>Operation not permittedcat <workspace>/.commonly/mcp-config.jsonOperation not permittedCOMMONLY_*/cm_agent_*valuesps -axewwoperation not permitted: psALLOWED~/.commonlyoperation not permittedcurl https://example.comLinux bwrap
The same harness passed in a Linux/arm64 Docker VM with Codex 0.144.1 and user namespaces available:
cat ~/.commonly/<synthetic-canary>No such file or directory)cat ~/.ssh/<synthetic-canary>No such file or directory)cat <workspace>/.commonly/mcp-config.jsonCOMMONLY_*/cm_agent_*values~/.commonlyRead-only file systemcurl https://example.comThis Linux run caught a real portability defect before the final pass: exact
.commonly/.codexchild-directory denies made bwrap abort withCan't create file ... Is a directory. The final policy uses scoped deny globs and the adapter test forbids reintroducing the exact entries.A default Docker container without user-namespace privileges refuses to start bwrap (
No permissions to create a new namespace). That failure is closed—no command or canary escapes—but the wrapper is unusable. Linux hosts therefore require working bwrap/user namespaces; host preflight and operator guidance remain follow-up work.Research conclusions
--sandbox workspace-write -a neverwas attacked first and did leak controlled~/.commonlyand~/.sshcanaries; it is not a confidentiality boundary.-coverrides avoid operator config mutation/profile races.CODEX_HOME, host/version resolution, fail-closed policy. Its current macOS full-access fallback was explicitly rejected.Tests
git diff --checkThe repository-wide lint command is currently red for unrelated pre-existing backend resolution/parsing errors; the changed CLI source and tests are clean under their relevant checks.
Remaining gates / follow-ups
sandbox.trust: public); selecting the product-wide trust default and migrating hq-support's environment are operator/ADR gates, not silently inferred here.