Inside the Codex sandbox · Michael Bolin, OpenAI · OpenAI Engineering, November 18, 2026
OpenAI documents the Codex sandbox and says stdio MCP servers run outside it
Codex runs commands in the user's own environment and limits them with each platform's sandboxing: Seatbelt on macOS, bubblewrap with seccomp on Linux. The built-in :workspace profile allows writes inside the workspace but keeps .git and .codex read-only, allows broad reads, and turns network access off. The post names a gap in those defaults. An agent could inject code into a locally installed package such as node_modules/prettier, which Git often ignores, and an editor that runs that copy on save would execute it outside the sandbox.
MCP is a second gap: "For a stdio MCP server configured in config.toml, the Codex harness does not attempt to sandbox the command used to start the server." The post shows how to wrap such a server in codex sandbox --permission-profile, with network access off and writes limited to named directories. It also notes that broad wildcard domain rules or access to DNS services can still permit DNS-based exfiltration through the network proxy.
Why it matters: If your Codex setup starts stdio MCP servers, they run with your full user permissions unless you wrap them yourself. The codex sandbox command also lets you test a permission profile against the specific writes it is meant to block before an agent runs under it.