How OpenAI's Codex limits what its coding agent touches
By default, OpenAI's Codex coding assistant can write only inside your project and has no internet. OpenAI published how it keeps commands in a safe box on your own computer. The post also lists weak spots, such as sensitive files elsewhere still being readable.
Codex doesn't run commands in a virtual machine. It uses the safety features built into each operating system to limit what commands can do on your own machine.
The default profile lets commands write inside the project folder. The .git and .codex folders stay read-only, and network access is off. Reading files across the machine is broadly allowed, so sensitive files elsewhere may still be visible.
OpenAI also notes that a harmful change to a package folder could run outside the box if an editor runs it.
On Mac it uses Seatbelt. On Linux it uses bubblewrap and seccomp. Windows is moving to Microsoft's MXC library. A network proxy enforces which websites are allowed or blocked, and company admins can limit which profiles staff may choose.
New to this? The key idea
A sandbox is a fenced area where a program can only do what the fence allows, like letting a visitor work in one room of a house but not wander into the rest. Here the fence is built from safety features already in the operating system, so there is no virtual machine to set up. The risk with a coding agent is that it runs commands for you, so the fence decides how much damage a wrong command can do.
Use it at work
Use it for: setting safe limits when letting a coding agent run commands on a developer laptop. Developers and the security and platform admins who set rules for them should care.
Try it: Codex lets you give its coding agent a permission profile in config.toml that says which folders it may read or write. Profiles sit under `[permissions]`, and entries can be `read`, `write` or `deny`. The `codex sandbox` command runs any command under a chosen profile, which is useful for checking that a profile blocks what it should. When the agent tries to write somewhere the profile doesn't allow (for example .vscode on macOS), it fails with "Operation not permitted" because .vscode is read-only under the profile. The article shows the exact configuration format; copy it from there rather than guessing the keys.
Before you roll it out: cost not stated. Admins can restrict choices with `requirements.toml` and `allowed_permission_profiles`. Network access is off by default, or can go through a proxy with domain allow and deny rules. Known limits: reads outside the project are broadly allowed, so sensitive files may be visible. Deny patterns are expanded before each command starts, so new matching paths are not covered automatically. Wildcard domain rules or DNS access can still allow data leaks through DNS. Stdio MCP servers are not sandboxed by default and must be wrapped manually. Code written into a package folder can still run outside the box later if an editor executes it. It uses Seatbelt on Mac, bubblewrap and seccomp on Linux, and Windows is moving to Microsoft's MXC library.
Summaries are written by AI from the linked source. Always check the original.