ANTM
AgentsAnalysis

Inside the Codex Sandbox: Seatbelt, Bubblewrap, a Network Proxy and What They Do Not Stop

OpenAI has published how Codex confines the commands an agent runs on your own machine. The design is a useful template for any coding agent, and the list of what it does not stop is as instructive as the list of what it does.

Editorial desk

Published 6 min read

A glowing teal rectangle on a dark background containing a large teal dot joined by a thin line to a small teal dot, with a small orange dot nearby
Illustration generated with AI (FLUX.1 [schnell] (Black Forest Labs) via Cloudflare Workers AI, Apache 2.0). Prompt and direction by ANTM.

A coding agent that can run shell commands is only as safe as whatever sits between a command and your machine. On 18 November 2026 OpenAI published an engineering post, "Inside the Codex sandbox" by Michael Bolin, describing how Codex confines the commands it runs on a user's own computer.[1] It is unusually specific about mechanisms and unusually frank about gaps. This article reads it alongside the documentation of the components it relies on, and turns it into a checklist you can apply to any agent tool. For the wider threat model, see how AI agents work and how to secure them and prompt injection defences that work by design.

What the default profile allows

Codex is designed to work in the user's existing environment rather than inside a container or virtual machine, and the sandbox restricts what the commands it launches can touch.[1] OpenAI describes it as one layer of "defense in depth" next to training and alignment. For the built-in :workspace profile, with a Git repository as the workspace root, the post gives these defaults:[1]

ResourceDefault in the workspace profile
Filesystem writesAllowed inside the workspace; .git and .codex stay read-only
Filesystem readsBroad, subject to normal OS permissions
NetworkDisabled

Making .codex read-only matters because it prevents a sandboxed command from editing .codex/config.toml or Git hooks, two ways a process could otherwise widen its own future permissions.[1] The broad read default is the notable choice: the post acknowledges that sensitive files elsewhere on the machine may remain readable.

How the harness hands out permission

One API, spawn_command_under_sandbox(), takes a command, a permission profile and an optional network proxy, and works across macOS, Linux and Windows. Child processes inherit the restrictions.[1] The main consumer is the exec_command shell tool. For each command the model can request one of three levels, and the harness decides whether to grant it:[1]

  • use_default: the turn's default sandbox configuration applies.
  • with_additional_permissions: expanded filesystem or network access, still inside the sandbox.
  • require_escalated: run outside the sandbox, with a justification shown to the user.

The harness evaluates these requests against user preferences. Codex may prompt the user or route the request to auto-review; the post does not define named approval modes beyond this.[1] The design point to take away is that the model asks and the harness decides, so a manipulated model can request more, but cannot grant itself more.

Profiles live under [permissions] in config.toml and can extend built-in ones. Filesystem entries use read, write or deny, with glob support such as **/*.env. Tables merge recursively with higher-precedence sources winning, arrays are replaced whole, and managed requirements.toml policy, including cloud-provided policy, can restrict which profiles users may choose.[1]

Three operating systems, three mechanisms

The enforcement layer differs per platform, and the differences matter when you assess a tool.

PlatformMechanismNotes from the post
macOSSeatbelt via /usr/bin/sandbox-exec, policies in SBPLBase policy starts with (deny default). Apple has deprecated the interface; OpenAI plans to keep using it for now.
Linuxcodex-linux-sandbox using bubblewrap, then seccomp-bpfSeparate network namespace; seccomp blocks connect(2) and bind(2) when networking is off; no_new_privs set.
WindowsMoving to Microsoft's MXC libraryThe earlier sandbox needed elevated setup and left persistent host state such as ACLs and firewall rules.

All three rows are from OpenAI's post.[1] Two companion projects are worth reading directly. Bubblewrap's own documentation says it "is not a complete, ready-made sandbox with a specific security policy": protection "is entirely determined by the arguments passed to bubblewrap," and "everything mounted into the sandbox can potentially be used to escalate privileges."[3] In other words, bubblewrap supplies the primitives (user, PID, network and mount namespaces, and PR_SET_NO_NEW_PRIVS to neutralise setuid binaries) and Codex supplies the policy. Microsoft's MXC describes itself as a "sandboxed code execution system" for untrusted code such as model output, builds on Bubblewrap by default on Linux and Seatbelt on macOS, and says some of its backends "are experimental."[4] The Windows migration is therefore a move onto a young component, which is a reasonable thing to watch.

The network proxy: where policy actually lives

When the network is neither fully off nor fully open, Codex runs codex-network-proxy, with HTTP and SOCKS5 listeners whose addresses reach sandboxed processes through variables such as HTTP_PROXY and ALL_PROXY. Programs that ignore those variables are stopped by the OS sandbox, which blocks direct connections.[1] The proxy's README describes the rules:[2]

  • Allowlist first: "if domains has no allow entries, requests are blocked until an allowlist is configured."
  • Deny wins: entries marked deny "always override the allowlist."
  • HTTPS CONNECT targets, including WebSocket tunnels, face the same host checks.
  • Matching is ASCII case-insensitive and does not convert between Unicode and Punycode, so internationalised domains must be written in Punycode.
  • Allowlisted hostnames that resolve to local or private addresses are still blocked, on a best-effort lookup.

For a domain with no matching rule the proxy can hold the request while the harness asks for approval, and the post says DNS resolution happens only after a request is allowed or approved, because a hostname lookup can itself leak data.[1] The README is candid that DNS rebinding "is not fully preventable at this layer" and advises enforcing egress lower down, in a firewall, VPC or corporate proxy, if hostile DNS is in your threat model.[2]

The limits OpenAI lists itself

This is the most useful part of the post. Its stated limits include:[1]

  1. Broad reads leave sensitive files outside the workspace readable.
  2. Harmful actions remain possible within allowed writes. The example is tampering with a locally installed node_modules/prettier that later runs when an editor formats on save, outside the sandbox.
  3. Wildcard rules and DNS access can still permit DNS-based exfiltration.
  4. Deny globs are expanded to concrete paths at launch, so files created later that match them are not restricted during that command.
  5. Stdio MCP servers are not sandboxed by default, because "Codex cannot reliably infer which files or network services that server needs."
  6. Seatbelt depends on a deprecated interface with undocumented SBPL, and the Windows sandbox is mid-migration.

Our interpretation: items 2 and 5 are the pattern to internalise. A sandbox bounds the process it wraps, but a project directory is also an input to other tools, and an agent's helper servers are separate processes. Both are paths around the boundary that no OS rule can close without knowing your workflow.

A checklist for any agent sandbox

This list is our synthesis, not OpenAI's. It uses the Codex design as a reference.

  • Is enforcement done by the operating system or by prompts to the model?
  • What can it read, not only write? Many tools restrict writes and leave reads open.
  • Are the files that control the agent's own permissions, such as config and hooks, protected?
  • Is the network off by default, and if proxied, do deny rules beat allow rules and does an empty allowlist block?
  • What happens on DNS? Broad wildcards can leak data through lookups.
  • Do helper processes, such as MCP servers, run inside the same boundary?
  • Can you test a profile? Codex provides codex sandbox --permission-profile <name> -- <command>, and the post shows a write to .vscode/settings.json failing with "Operation not permitted" under a restrictive profile.[1]

What we have not verified

We read the post and the three linked projects' own pages. We did not run Codex, test the profiles or audit the source, so every behaviour above is as documented by OpenAI, bubblewrap and Microsoft, not as we observed it. The post is the vendor's own description of its design.

Frequently asked questions

Does the Codex sandbox stop an agent reading my files?
Not by default. OpenAI says reads are broad and subject to existing operating-system permissions, so sensitive files outside the workspace may remain readable unless you add deny rules.[1]
Is the network blocked?
In the built-in workspace profile, yes. Access can be enabled in full, or routed through a proxy that applies domain allow and deny rules.[1][2]
Are MCP servers sandboxed?
Not by default for stdio servers. OpenAI says Codex cannot reliably infer which files or network services a server needs, though the codex sandbox command can wrap one.[1]

Follow ANTM

The signal, not the noise.

Email signup is paused. Every new story appears in our RSS feed, which works in any feed reader.

Referenced sources

  1. 1.
    Inside the Codex sandbox(opens in a new tab)

    OpenAI (Michael Bolin)CompanyPublished Nov 18, 2026

  2. 2.
    codex-network-proxy README(opens in a new tab)

    OpenAI, openai/codex repositoryPrimary source

  3. 3.
    bubblewrap(opens in a new tab)

    containers project, GitHubPrimary source

  4. 4.

ANTM Editorial

Editorial desk

The editorial desk at AI's Next Top Model. Every article cites the documents it is sourced from. See the editorial policy for how we work.