OpenAI has published a technical explainer called Inside the Codex sandbox, and the timing is either excellent or hilarious. Two months ago, security researchers walked out of that sandbox twice, including once from the mode where Codex is not supposed to write anything at all.
So this is the fence manual, delivered after the fence had already been climbed. To OpenAI's credit, it is a genuinely useful read, and the fence is a real fence rather than a marketing diagram with arrows on it.
The Fence, In Plain English
Codex runs commands on your machine. The sandbox decides which files those commands can touch and whether they can reach the network. That decision now lives in what OpenAI calls permission profiles, and the defaults are more conservative than you would guess for a product that will cheerfully refactor your entire repository.
- Workspace is the default when your directory is a Git repo. Writes are allowed inside the workspace, but .git and .codex stay read-only, reads run broadly subject to whatever your operating system already permits, and network access is off.
- Read-only is the strictest ordinary mode. Commands can look. They cannot touch.
- Custom profiles can allow writes to one folder, such as ~/Pictures, while denying the network entirely.
The network detail is the one worth appreciating. Blocking egress is what stops an agent from turning "summarize this repo" into "upload this repo." OpenAI says those restrictions are enforced through a shared network proxy, not by asking the sandbox to please decline politely.
Enforcement itself is delegated to the operating system, which is the correct design and the exact opposite of what went wrong in September. On macOS, Codex uses Seatbelt and sandbox-exec. On Linux, bubblewrap plus seccomp-bpf. On Windows, it is mid-transition to MXC, the Microsoft eXecution Container. Child processes inherit the same boundaries, which matters for anything that shells out to a build script.
There is also a codex sandbox command that runs an arbitrary command under a named profile. That is the sort of boring utility that quietly becomes the most valuable part of a release, because it lets you wrap an MCP server's start command in the same restrictions instead of trusting a stranger's package to behave.
Meanwhile, In September
Here is where the explainer stops reading like documentation and starts reading like a confession with good posture.
On September 20, researchers at Accomplish AI published two working escapes, reported to OpenAI on August 12 and fixed within eight days. The first, Heapjack, is a small masterpiece of bad assumptions. Codex Desktop installs a component called node_repl into your global config, with no opt-in and no switch to turn it off.
- That component runs one Node process with a trusted context and an untrusted one, and the trusted side proves itself with a random token generated on every run.
- Both contexts share a single memory heap, so the token is just a string sitting where untrusted code can read it. The exploit dumps the heap with v8.getHeapSnapshot() and tries every UUID-shaped string it finds.
- A wrong guess returns "not authorized." A correct guess with a malformed argument returns a real validation error. That difference is the whole attack, and with the token the untrusted side writes to the same pipe the trusted side uses, where an unsandboxed parent process does the work.
All of that ran in read-only mode, with no approval prompt and nothing shown on screen. Open someone else's repository, ask a question about the code, and the person who wrote it gets command execution on your machine.
The second escape, Overpatch, abused the patch tool itself. apply_patch worked out write permissions from the paths inside the patch you handed it, so naming /tmp widened the grant to the root of the disk, and a symlink into the home directory let a single line land in .zshrc. The next terminal you opened ran it, unsandboxed.
Both bugs share a shape, and that shape is what makes this week's explainer worth reading. The enforcement mechanism was living inside the thing it was supposed to be enforcing. The patch tool asked the patch whether the patch was allowed. The trusted context kept its secret in the untrusted context's memory.
Which is why platform-native enforcement is the right fix rather than a rebrand. A sandbox that lives in the kernel does not care what the patch says about itself.
None of this makes Codex uniquely careless. Pillar Security found the same inside-out pattern across Cursor, Codex, Gemini CLI and Antigravity in July. October brought a grey-market relay service that simply rewrote agent settings to switch sandboxes off, and a plain text file trick that waited in the Downloads folder for a curious agent to read it.
The practical takeaway for anyone running a coding agent this week is unglamorous. Check which profile your session is actually using. Keep the network off unless the task needs it. Wrap MCP servers in a restricted profile where the tool supports it. Read the explainer, because a fence you understand is a fence you can check.
As explainers go, this one is clear, specific and honest about the mechanisms. It is also the documentation for a wall that shipped two known holes, both now patched, both instructive. Mature security posture or the most candid release note of the year? Possibly both, and definitely cheaper than the alternative.
Comments