OpenAI published a detailed account on 18 November of how its Codex coding agent runs commands on a user’s own computer without free rein. Michael Bolin, a member of technical staff at OpenAI, wrote the engineering post, titled “Inside the Codex sandbox.” The short version: every command the agent launches sits inside rules about which files it may touch and which servers it may reach.
A sandbox is a restricted room for a running program. The program can only use what the room’s rules allow. Bolin’s example is a photo-sorting job, where commands may change files in ~/Pictures while the network stays off, so nothing can be uploaded. A code review might instead get online documentation but leave source files untouchable. Users write these rules as permission profiles.
The built-in
profile is deliberately cautious. Commands can write inside the project folder, but directories such as .git and .codex stay read-only, so the agent cannot quietly rewrite Git hooks or its own configuration. Reads are broad across the machine, because compilers and build tools need libraries that live outside the repository. The network is off. That blocks uploads, and it also blocks downloading dependencies.OpenAI is candid about the gaps. Broad reads mean config files holding API keys may remain visible to a command. Bolin also describes an attack the sandbox does not stop: an agent could plant malicious code in node_modules/prettier, a folder Git often ignores. If the user’s editor then runs Prettier on save, the code executes outside the sandbox. OpenAI’s answer is defense in depth, pairing the sandbox with training and alignment of the model.
OpenAI chose not to use virtual machines or containers. In Bolin’s example, running Codex inside Docker would stop it from using the iOS build toolchain of native Mac programs or launching the iPhone simulator. So Codex leans on each operating system’s own enforcement instead. Child processes inherit the sandbox, which means the limits hold across everything a command spawns.
Network control runs through a proxy. A profile can block all traffic, allow all of it, or send requests through a proxy that checks domain rules. One example allows *.openai.com and localhost while denying evil.example, and a deny always beats an allow. A request to an unlisted domain can pause for approval from the user or from auto-review. The proxy looks up a hostname only after approving it, since even a DNS lookup can leak data encoded in the name. OpenAI notes that very broad wildcards, or access to DNS services, can still allow that kind of leak.
Enforcement differs by platform. On macOS, Codex uses Seatbelt through the sandbox-exec command, which Apple’s manual page labels deprecated; OpenAI says it will keep using it, noting that Google Chrome and Chromium rely on it too. On Linux, Codex combines bubblewrap with seccomp-bpf, a kernel filter for system calls. On Windows, OpenAI is replacing its earlier sandbox with one built on MXC (Microsoft eXecution Container), citing the old design’s need for admin access during setup and slow permission checks.
Enterprises get a lever of their own. Administrators can set requirements.toml to limit which profiles employees may choose, for instance allowing
while forbidding . Cloud requirements outrank the system file at /etc/codex/requirements.toml.Developers outside OpenAI can reuse the machinery. The codex sandbox command wraps any command in a profile. Bolin shows it confining the memory MCP server, pinned at version 1.0.0, so it writes only to the npm cache and its data folder, with no network.
All of this comes from OpenAI’s own description, and the post cites no independent testing. The candid part is the useful part: reads are wide open by default, and writes are where the guardrails sit. Before letting any agent loose on a laptop, list the secrets it could read and the folders it could poison, then write profile rules for those first.
Based on “Inside the Codex sandbox” by Michael Bolin, published by OpenAI on 18 November 2026.