ResearchOpenAI
OpenAI Codex runs commands safely on your machine
Original title: Inside the Codex sandbox
- Date
- Company
- OpenAI
- Type
- Research
- Source
- OpenAIRead the source (opens in a new tab)

Plain language
- What it is
- OpenAI explained the Codex sandbox, which runs commands on your computer while keeping your files and network safe. It lets you control what the system can access.
- How it works
- It uses the built-in security features of your computer's operating system to limit what commands can do. You can set up permission profiles to decide which folders Codex can read or write, and whether it can connect to the internet.
- Where it is available
- It works on macOS, Linux, and Windows. It is used in Codex sessions, the Codex CLI, and the ChatGPT desktop app.
- Example
- You can set up the sandbox for a photo-organizing task to let Codex edit files in your Pictures folder. At the same time, the system will block it from accessing the internet.
For developers
- What it is
- OpenAI detailed the architecture of the Codex sandbox, which executes commands locally while enforcing user-defined filesystem and network constraints.
- How it works
- Codex uses each platform's native sandboxing facilities to constrain commands in the user's existing environment. This approach avoids moving computation to separate virtual machines or Docker containers. The Codex harness calls a unified API named spawn_command_under_sandbox with a permission profile and an optional network proxy to run child processes under these constraints.
- Where it is available
- It is available on macOS, Linux, and Windows, and is integrated into the Codex harness, Codex CLI, and ChatGPT desktop app.
- Example
- The built-in :workspace permission profile allows write access within the workspace root, keeps directories like .git read-only, and disables network access to prevent data exfiltration.
The original post
The headline and explanation on this page are based on OpenAI's post. The full details are in the original.
Inside the Codex sandbox
Read the source (opens in a new tab)