Skip to main content
Back to timeline
OpenAI NewsSource publication:

Codex's sandbox keeps commands on your own machine: file and network limits come from permission profiles, not a container

Synopsis

OpenAI has described how the Codex sandbox works: rather than moving computation into a virtual machine or container, it invokes each operating system's own isolation facilities to limit which files a command can touch and which network it can reach inside the user's existing development environment. Users set the boundaries through permission profiles, and the built-in :workspace profile allows writes inside the workspace, keeps .git and .codex read-only, and disables network access by default. OpenAI also states that these limits do not stop all harmful behavior, such as injecting code into a locally installed dependency.

AI-generated editorial illustration: Inside the Codex sandbox

Interpretation

When Codex runs commands it does not need a separate isolated environment; commands run on the user's existing machine and directories, with file and network access constrained by an operating-system-level sandbox. Virtual machines and containers are common sandboxing approaches, but they move computation to another environment; for workflows that depend on host tools, such as building an iOS app on a Mac and launching the simulator, Codex inside a container could not run those native executables directly. OpenAI uses iOS development to illustrate the tradeoff: with Codex inside Docker, builds and simulator operations would have to be delegated to the Mac host, executing outside the container's sandbox and needing their own restrictions.

The sandbox launches commands through one cross-platform interface: the caller supplies a command and a permission profile, plus a network proxy when network access must be limited. The isolation mechanisms of macOS, Linux and Windows sit behind the same launch function, and child processes inherit their parent's sandbox constraints, so the restrictions cover the whole process tree. On macOS it uses Seatbelt and sandbox-exec, on Linux a combination of bubblewrap and seccomp-bpf, and on Windows it is replacing its existing sandbox with one built on Microsoft's MXC library.

Permissions are written as named profiles in config.toml, which can extend built-in profiles and override entries one by one, and enterprise administrators can use managed requirements to constrain which profiles users may select. The built-in :workspace profile allows writes inside the workspace, keeps directories such as .git and .codex read-only, allows broad reads subject to existing OS permissions, and disables network access by default. The example dev profile extends :workspace, adds write access to ~/build-cache, makes .vscode read-only and denies **/*.env and secrets; running a command under codex sandbox that writes .vscode/settings.json fails on macOS with Operation not permitted.

Perspective

The design targets coding agents that run commands on a developer's own machine and covers macOS, Linux and Windows, with the Windows implementation being migrated to Microsoft's MXC library. OpenAI says it wants to make sandboxing practical for more tools and environments, make permissions easier to configure, and take advantage of better operating system protections as they become available.

OpenAI states plainly that these restrictions prevent a large class of bad behavior but that harmful actions are still possible, for example injecting code into a locally installed package under node_modules, a change that might not appear in git status. On the network side, broad wildcard rules or access to DNS services can still permit DNS-based exfiltration; macOS's sandbox-exec is marked deprecated, and OpenAI says it plans to keep using Seatbelt for the foreseeable future.