How the Codex sandbox works: OpenAI's defaults, settings and stated limits
OpenAI says Codex's built-in workspace profile allows writes in the workspace and broad reads, subject to the user's existing OS permissions, but no network, and that harmful actions are still possible. Here is what it restricts, how to change it, and where OpenAI says it falls short.

OpenAI published "Inside the Codex sandbox" on its engineering blog on 18 November 2026. It explains how Codex, its coding agent, limits what the commands it runs on your machine can reach, and how users and administrators change those limits. This guide sets out the defaults, the settings OpenAI shows, and the gaps OpenAI itself names.
What the built-in workspace profile allows and blocks
OpenAI says Codex is configured through "permission profiles", which "define the filesystem and network restrictions for a Codex session". Its stated philosophy is "conservative defaults for the sandbox that still enable meaningful work". With a Git repository as the workspace root, the built-in :workspace profile, in OpenAI's words:
- Files you are working on: "Allows writes within the workspace, while keeping directories such as"
.gitand.codexread-only. The post's example shows.agentsand.awsunder the workspace root also set to read-only. - The rest of the disk: "Allows broad filesystem reads, subject to the user’s existing OS permissions." OpenAI adds that "sensitive files elsewhere on the machine may also remain readable (such as config files containing API keys)."
- Network: "Disables network access." OpenAI says this blocks direct uploads to external services, including exfiltration attempts, but also stops dependency downloads.
- Processes (for any profile): "Each child process inherits its parent’s sandbox constraints", so the limits cover the whole process tree a command starts, "even to descendants that outlive the original process."
Changing the settings
OpenAI's examples for users' own settings live in config.toml. You define a named profile under [permissions], can base it on a built-in one with extends, and pick it with default_permissions. Filesystem entries take read, write or deny. Adapted from the post (comments, the description line and the .devcontainer entry removed):
default_permissions = "dev"
[permissions.dev]
extends = ":workspace"
[permissions.dev.filesystem]
"~/build-cache" = "write"
[permissions.dev.filesystem.":workspace_roots"]
".vscode" = "read"
"**/*.env" = "deny"
"secrets" = "deny"
For the network, OpenAI describes "roughly three options": no network (the :workspace default), full direct access (the default for :danger-full-access), or routing through a proxy that checks domain rules. Setting permissions.dev.network.enabled = true gives full access when the proxy is off. To limit a profile to set domains, the post turns on network_proxy = true under [features] and lists domains as allow or deny; it says "explicit deny rules taking precedence over allow rules", and other domains need approval or are blocked.
To test a profile, the CLI has a sandbox command, for example codex sandbox --permission-profile dev -- <command>. We checked that the sandbox subcommand and its --permission-profile flag exist in the openai/codex repository (Apache-2.0, per the GitHub API). Inside a session, the model can request with_additional_permissions or require_escalated, but OpenAI says "the harness decides whether to grant the request", based on the user's preferences; for example, Codex may prompt the user or route the request to auto-review.
For IT teams
OpenAI says settings from several config.toml files are merged, with tables merged recursively and arrays replaced whole. Administrators can push "managed requirements" through requirements.toml, from several sources, including system files and cloud-provided policy. The post's example uses allowed_permission_profiles to set ":danger-full-access" = false; profiles that end up false or missing "are unavailable".
What the sandbox does not cover
OpenAI is explicit that "harmful actions are still possible". The limits the post names include:
- An agent could plant malicious code in a locally installed package such as
node_modules/prettier, which may not show ingit status; if your editor runs it on save, it could "execute the malicious code outside the Codex sandbox." - Readable secrets outside the workspace, as above.
- For a stdio MCP server set in
config.toml, "the Codex harness does not attempt to sandbox the command used to start the server." OpenAI shows wrapping it incodex sandbox --permission-profileinstead. - OpenAI notes that "broad wildcard rules or access to DNS services can still permit DNS-based exfiltration."
- Deny globs are expanded to real paths before launch, so new matching files are not automatically added while the command runs (OpenAI states this for Linux and Windows).
- For the proxy, OpenAI says "not all programs honor these environment variables", though OpenAI says the operating system's sandbox restrictions then block direct connections to external hosts.
OpenAI frames the sandbox as one layer of "defense in depth", alongside training and alignment.
Platform differences
- macOS: Codex uses Apple's Seatbelt through
/usr/bin/sandbox-exec. OpenAI notesman sandbox-execcalls it "DEPRECATED" but says "we plan to continue to use Seatbelt for the foreseeable future." - Linux: bubblewrap plus seccomp-bpf, with separate namespaces for mounts, IPC and process IDs, and network isolation when networking is off or proxied. Codex ships its own
bwrapbut prefers a compatible one onPATH; OpenAI says some distributions disable access to user namespaces by default, but grant an exception for the systembwrap. - Windows: OpenAI says it is "currently replacing our existing sandbox" with one built on Microsoft's MXC library, which Codex already supports "on compatible Windows devices". Clipboard access and input injection are disabled; direct external connections are blocked, but "Other local services remain reachable."
Why it matters
On our reading, the practical point for teams is the default trade-off OpenAI names itself: Codex can read most of the disk but not reach the network, so secrets in home-directory config files and unsandboxed MCP servers are the places to look first. OpenAI says the codex sandbox command is commonly used to test a profile, to make sure it blocks what it was designed to block.
Ask Relay — he reads every question himself and replies personally by email.
