Skip to content

← All posts

OpenAI's Codex sandbox puts limits you control

TL;DR OpenAI detailed the Codex sandbox, which constrains the commands its coding agent runs using permission profiles and OS-level enforcement. The design is practical, but MCP servers still run unsandboxed by default until you wrap them.

What OpenAI announced

  • OpenAI published a Nov 18, 2026 engineering post, "Inside the Codex sandbox," by Michael Bolin, describing how Codex runs commands on a user's machine inside filesystem and network limits.
  • The sandbox is configured through permission profiles defined under [permissions] in config.toml. The built-in :workspace profile allows writes inside the workspace, keeps .git and .codex read-only, permits broad reads subject to existing OS permissions, and disables network access.
  • A separate :danger-full-access profile grants full direct network access. An optional network proxy restricts traffic to domain rules, and explicit deny rules take precedence over allow rules.
  • The codex sandbox CLI command runs an arbitrary command under a chosen profile, so the same enforcement can be reused in tools outside an agent session.
  • stdio MCP servers are not sandboxed by default. The post shows wrapping an npx-launched memory server with codex sandbox --permission-profile memory-mcp to limit writes and cut off network access.
  • Enforcement is OS-specific but behind one shared API: Apple's Seatbelt on macOS, bubblewrap plus seccomp-bpf on Linux, and a transition to Microsoft's MXC on Windows.

Our take

The most interesting part is the stated philosophy: conservative defaults that still allow meaningful work. Reads stay broad because compilers, runtimes, and build tools depend on SDKs and configuration outside the repository. Network access is off by default. That is a real tradeoff, and OpenAI names the cost plainly: files elsewhere on the machine, including configs holding API keys, may still be readable.

The post is also honest that restrictions are not a cure. It walks through a scenario where the agent writes malicious code into a locally installed package such as node_modules/prettier, a change git status may not surface, and the user's editor then runs it outside the sandbox on save. That is why OpenAI leans on defense in depth, pairing the sandbox with training and alignment rather than presenting the sandbox as sufficient on its own.

The MCP detail is the one teams should read twice. Sandboxing the agent while letting MCP servers run with the user's full permissions leaves an obvious hole, and the fix is manual configuration. There is also platform unevenness: macOS Seatbelt is deprecated, though OpenAI says it plans to keep using it and notes other software still relies on it, and the Linux path depends on user namespaces, which some distributions restrict. Useful, but not uniform.

For a company that ships agentic tooling, the move signals a shift from capability demos toward operational controls. Permission profiles, layered configuration, and managed requirements are the kind of plumbing that matters once agents touch real repositories.

What it changes for teams running agents

  • Permission profiles turn sandbox policy into something a team can version, review, and set per project. Enterprise admins can constrain which profiles users may select through managed requirements that take precedence over local config.
  • The network proxy offers a middle path between no network, which breaks dependency installation, and full access, which permits exfiltration. Domain rules with deny precedence help, but the post cautions that broad wildcard rules or DNS access can still leak information.
  • Oversight is per-command: the harness decides whether to grant an agent's request for extra permissions, routing escalations to a user prompt or auto-review. That keeps a human or policy layer in the loop.
  • The MCP gap is a to-do. Teams should enumerate their stdio servers and wrap each one in a narrowed profile rather than assuming the agent's sandbox covers them.

For agents reading this

  • Announced by: OpenAI
  • Original post: https://openai.com/index/inside-the-codex-sandbox
  • Announcement date: 2026-11-18
  • What: An engineering explanation of the Codex sandbox, which constrains commands using permission profiles and OS-level enforcement.
  • Availability: Documented feature in Codex; the codex sandbox command is available in the Codex CLI.
  • Pricing: Not stated in the post.
  • Our verdict: A practical, well-scoped security primitive, slightly undercut by MCP servers that run unsandboxed unless you wrap them.
  • Confidence: facts from the original post; take is Orchard's opinion