What the Codex sandbox blocks and what it can’t

OpenAI has published a detailed look at the sandbox around Codex, its coding agent. A sandbox limits what a program can touch while it runs. Codex doesn’t move your work into a separate virtual machine or container. It runs commands in your usual environment, and the operating system enforces the file and network limits you set. OpenAI walks through the defaults, the gaps it knows about and how the limits are enforced on macOS, Linux and Windows in a post on its site.
The reason is practical. One of the most common things Codex does, and one of the riskiest, is run commands on your computer. Many developers treat their laptop as a dev environment built up by hand, and copying it into a container takes work. OpenAI’s example is an iOS app: Codex running inside Docker on a Mac couldn’t use Apple’s native build tools or open the iPhone simulator.
What it allows by default
The standard profile, called :workspace, lets Codex edit files in your project without asking each time. Two folders stay read-only: Git’s internal folder and Codex’s own settings folder, so the agent can’t rewrite its own config or slip in Git hooks. Codex can read most of the rest of the computer, within your normal user permissions, because compilers and build tools need libraries outside the project. Network access is off.
OpenAI is open about the cost. With the network off, a command can’t upload your data anywhere, but it also can’t download dependencies. And because reads are broad, sensitive files elsewhere on the machine, such as config files holding API keys, stay readable.
What it doesn’t stop
OpenAI says plainly that harm is still possible. Its example: the agent could plant malicious code in a locally installed tool, such as the Prettier code formatter inside a project’s node_modules folder. Git usually ignores that folder, so the change might not show up when you check what was modified. If your editor runs Prettier every time you save, saving a file would run the code outside the sandbox. The sandbox limits what commands can reach, OpenAI writes, and it counts on the model’s training to use that access the way the user intends.
There are other gaps. Codex doesn’t sandbox the MCP servers you add to its config (the add-on tools that give the agent extra abilities), because it can’t tell what files or network access each one needs. Those servers run with your full permissions unless you wrap them yourself, and the post shows how. Even with network rules in place, OpenAI notes that broad wildcard rules or access to DNS services can still let data leak out. Outside researchers have found holes too: in August, one broke out of Codex Desktop’s strictest read-only mode, and OpenAI patched the flaw within eight days.
Changing the limits
You set the limits through permission profiles in Codex’s config.toml, marking each folder as readable, writable or blocked. For the network there are three choices: off, fully open, or routed through a proxy that checks each request against lists of allowed and blocked domains. When a request goes to a domain on neither list, Codex can ask you or hand the decision to its automatic reviewer.
Companies can go further. Administrators can limit which profiles their staff are allowed to pick, for example switching off the profile that gives full access. The codex sandbox command runs any command under a chosen profile, so you can check that a profile really blocks what it’s meant to block, or use the same sandbox in your own tools.
What comes next
On Windows, Codex is replacing its current sandbox with one built on MXC, a new Microsoft library for running code in isolation. OpenAI says the current version needs admin rights to set up, runs slow permission checks and leaves setup changes behind on the machine, such as firewall rules and sandbox user accounts. On macOS, Codex relies on Apple’s Seatbelt. Apple marks the command Codex uses to start it as deprecated, but OpenAI plans to keep using Seatbelt for the foreseeable future.
Up next
Amazon and Google will own nearly 30% of Anthropic
Amazon bought into Anthropic in 2023 and 2024 with notes that convert at about $2.09 or $5.05 a share. After the IPO it will own 14.7%, and could reach 23.8%, TechCrunch reports. Would Amazon owning nearly a quarter of Anthropic bother you as a user?
Related stories
- Reading a repo was enough to break out of Codex
- Forced rm detection tightened in Codex
- Prompt injection reached the official Codex npm pipeline
- Embedded browsers in Codex and VS Code leak the whole disk
- Codex CLI 0.157.0 leaves a daemon running after you quit
- Codex Security Cloud reviews commits with the laptop closed
Comments
No comments yet. Be the first.
Join the conversation
Sign in to leave a comment. It appears after moderation.

