If you are rolling Codex out to developers, its default sandbox covers the commands the agent runs and very little else, and stdio MCP servers start outside it. A domain allowlist does nothing unless the network proxy feature is switched on, and only a managed requirements.toml stops a developer from picking full access. That is OpenAI's own account. In Inside the Codex sandbox, published November 18, 2026 by Michael Bolin of OpenAI's technical staff, the company describes how Codex confines commands on macOS, Linux and Windows, and where it stops.
The defaults are sensible for a single developer. They leave a security team with five gaps to close before a fleet rollout, and each one has a specific setting.
What the Default Codex Sandbox Actually Allows
The default :workspace profile lets a command write inside the project, read almost anything the user can read, and reach no network at all. Per OpenAI's post, writes are allowed within the workspace root, while .git and .codex stay read-only, which blocks "direct changes to .codex/config.toml or Git hooks under .git/hooks." The example configuration in the same post also marks .agents and .aws inside the workspace as read-only.
Reads are broad: "subject to the user's existing OS permissions," in OpenAI's words. The post concedes the tradeoff. Config files holding API keys elsewhere on the machine may stay readable to anything the agent runs. With the network off, that read access has nowhere to go, which is why the network setting carries so much of the weight.
The design choice behind this is deliberate. Codex uses each operating system's own sandboxing "to constrain commands running in the user's existing environment," rather than shipping work into a VM or container. OpenAI's example is an iOS build on a Mac, which Docker cannot run. That is a fair reason, and it is also why the sandbox can only be as strong as the OS primitive under it.
A permission profile, in Codex terms, is a named set of filesystem and network rules applied to every command the agent launches. Built-in profiles start with a colon (:workspace, :read-only, :danger-full-access), and you can define your own under [permissions] in config.toml, with each path set to read, write or deny.
How Codex Sandboxes Commands on Mac, Linux and Windows
Each platform gets a different mechanism, and each has a caveat your endpoint team should know. The details below come from OpenAI's post unless linked otherwise.
| Platform | Mechanism | What to check |
|---|---|---|
| macOS | Seatbelt via /usr/bin/sandbox-exec, base policy (deny default) |
Apple's man page marks sandbox-exec deprecated; OpenAI says it will keep using it "for the foreseeable future" |
| Linux | codex-linux-sandbox driving bubblewrap, plus seccomp-bpf |
Some distributions disable unprivileged user namespaces, which bubblewrap needs |
| Windows | Moving to Microsoft's MXC library | Replaces an earlier design that needed admin rights at setup |
On Linux, Codex runs bubblewrap, the "low-level unprivileged sandboxing tool used by Flatpak," and layers a seccomp filter on top. It sets no_new_privs so setuid binaries cannot escalate, passes --unshare-net whenever the network is off or proxied, and blocks connect(2) and bind(2) when networking is disabled. Codex vendors its own bwrap but prefers a compatible copy on PATH. The catch OpenAI names is that "some Linux distributions disable access to user namespaces by default." Ubuntu is the familiar case: its 2023 change added the kernel.apparmor_restrict_unprivileged_userns sysctl. If your developer images set it, test Codex on them before you assume the sandbox is running.
On Windows, Codex is "currently replacing our existing sandbox with one that makes use of the MXC library." MXC is Microsoft's "sandboxed code execution system for running untrusted code (model output, plugins, and tools) on Windows, Linux, and macOS." The previous design, described in OpenAI's May 13 post on building the Windows sandbox, "requires elevated admin permissions at setup time" and ran commands as two local users, CodexSandboxOffline and CodexSandboxOnline. OpenAI says the MXC version removes the admin requirement, the slow ACL checks and the "persistent sandbox setup state on the host machine." In the MXC configuration, clipboard access and input injection are disabled, and MXC is blocked from falling back to rewriting host file permissions. We covered the management gap around MXC itself when it shipped: Intune could not yet manage it.
Why Stdio MCP Servers Run Outside the Codex Sandbox
Codex does not sandbox the command that starts a stdio MCP server, because, per OpenAI, it "cannot reliably infer which files or network services that server needs." Under the MCP specification, "the client launches the MCP server as a subprocess" and talks to it over stdin and stdout. In practice that subprocess is often npx or uvx pulling a package from a public registry, running with the developer's full permissions and full network.
This is the largest gap in the default. A developer who adds a community MCP server to config.toml has, in effect, given an unreviewed package the access the sandbox was built to withhold. The network proxy does not cover it either: OpenAI's approvals and security page says the proxy "does not filter web search, app or connector tool calls, MCP server connections, browser or Computer Use activity."
OpenAI's post shows the fix. Wrap the server's launch command in codex sandbox --permission-profile <name>, define a profile that grants ":root" = "read", write access only to the paths the server needs (the example uses ~/.npm and ~/mcp-data), and network.enabled = false. Pre-cache the pinned package and launch it with npx --offline. The offline launch is the step teams skip, and an MCP version pin may not freeze its dependencies, so an offline launch from a reviewed cache is what makes the pin real.
At fleet scale, the managed configuration can also restrict which servers load at all. OpenAI's managed configuration docs describe an mcp_servers allowlist that enables a server "only when both its name and identity match an approved entry." Use both. The allowlist decides which servers run; the wrapper decides what they can touch. Our MCP governance guide makes the case for enforcing at the client for the same reason.
When a Codex Domain Allowlist Does Nothing
A domain allowlist in a Codex profile is enforced only when the network_proxy feature is enabled, and without it the profile gets direct network access. OpenAI's own sample config says so in a comment: "If neither local config nor managed requirements enable the proxy, this profile allows direct network access; domain rules are not enforced." The config reference lists features.network_proxy as experimental and off by default.
So if your security team plans to hand developers a profile that allows your package mirror and a few vendor domains, set [features] network_proxy = true in managed requirements as well. Left to each laptop's config, the allowlist may never be enforced, and the command can reach anything.
With the proxy on, the controls are reasonable. Deny rules beat allow rules; unmatched domains are held for approval or blocked; hostnames are resolved only after a request is allowed, because "even a DNS lookup can leak information encoded in a hostname." OpenAI still warns that "broad wildcard rules or access to DNS services can still permit DNS-based exfiltration," so keep wildcards to domains you control. An OpenAI agent escaped containment through DNS in September, and its automatic shutdown failed for 2.5 hours.
The proxy also depends on programs honoring HTTP_PROXY, HTTPS_PROXY and ALL_PROXY, and OpenAI admits "not all programs honor these environment variables." On macOS, OpenAI says the Seatbelt policy allows outbound connections only to the local proxy ports, and on Linux the command runs in its own network namespace, so a tool that ignores the variable should fail to connect rather than go around the proxy.
Two Gaps No Setting Fully Closes
Two limits in OpenAI's post have no config switch, so they belong in your threat model rather than your rollout checklist.
The first is that deny globs are a snapshot. A deny rule on a pattern is expanded into concrete paths before each command starts, and "new matching paths are not automatically added to that command's sandbox restrictions," the post says. If a build step creates a new .env file that matches your pattern mid-command, the rule does not cover it until the next command. Denying the whole directory avoids the problem, as long as the directory exists when the command starts.
The second is that files the agent edits can run later, outside the sandbox. OpenAI's example is a change to node_modules/prettier, which may not appear in git status. If the developer's editor runs that Prettier on save, it "could execute the malicious code outside the Codex sandbox." The Prettier extension for VS Code does use the project's copy: "If your project has a local installation of Prettier (in node_modules), that version will be used instead of the bundled version." The same logic applies to Git hooks (which is why .git is read-only), test runners, language servers and anything else that executes project files. Once the agent's command exits, whatever your toolchain does with the edited files runs with the developer's full permissions.
How to Stop Developers Choosing Full Access
Only a managed requirements.toml can take :danger-full-access off the menu; user-level config.toml cannot. Admins list the profiles they permit under allowed_permission_profiles, and any profile set to false or missing from the merged result is unavailable, per OpenAI's post.
Requirements can come from several places, and the order matters. The post says cloud requirements "would take precedence over the system requirements file at /etc/codex/requirements.toml," so a local file cannot re-enable a profile the cloud policy disabled. OpenAI's sandboxing docs add that MDM and legacy managed-device requirements rank above the cloud bundle, and the managed configuration page describes a macOS profile in the com.openai.codex domain for that. Higher layers override scalar and list values from lower ones, while permission allowlists combine by profile name, so check the merged result rather than any single file.
The same file controls hooks. The Codex repository's config notes say allow_managed_hooks_only = true works only in requirements.toml, and "putting it in config.toml does not enable managed-hooks-only mode." Any Codex control you care about belongs in requirements.toml, because a developer can edit their own config.toml. Claude Code admins went through the same exercise when auto mode became the default and had to move deny rules into managed settings.
What to Do Before You Roll Out Codex
This Week:
- Inventory every
[mcp_servers]entry in your developers'config.tomlfiles, and treat each stdio server as unsandboxed code running with their credentials. - On one Linux developer image, check
kernel.apparmor_restrict_unprivileged_usernsand confirm Codex's bubblewrap sandbox actually starts. Do the same on one Windows machine after the MXC update lands. - Grep any custom Codex profiles for
[permissions.*.network.domains]. Ifnetwork_proxyis not enabled in managed requirements, those rules are not enforced.
This Month:
- Ship a managed
requirements.toml(cloud policy, plus MDM on macOS) that disables:danger-full-access, enables[features] network_proxy = true, sets anmcp_serversallowlist and turns onallow_managed_hooks_only. - Wrap every approved stdio MCP server in
codex sandbox --permission-profilewith network off and write access limited to its own data directory, launched offline from a reviewed cache. - Replace any wildcard broader than your own domains in egress rules, and route package installs through an internal mirror so the allowlist can name one host.
Before Wider Rollout:
- Ask your endpoint team which editor and toolchain features execute project files automatically (format on save, Git hooks, test watchers) and decide which to disable in agent workspaces.
- Convert file-pattern deny rules to directory-level denies so mid-command file creation cannot slip past them.
The Bigger Picture
Codex builds on the same primitives desktop Linux already uses to contain untrusted apps (bubblewrap came out of Flatpak), plus Seatbelt on the Mac and Microsoft's MXC on Windows, with one policy file over all three. For a tool that runs in the developer's real environment, that is close to the ceiling. The weak points are the helpers around the agent (MCP servers, editors, hooks), and the core has failed before: the July round of sandbox escapes hit Cursor, Codex, Gemini CLI and Claude Cowork in one week. If you need isolation that does not depend on the laptop, the option is a remote sandbox, and idle time sets that bill.
OpenAI has written down where its sandbox ends. Your first task is the [mcp_servers] inventory, since every stdio entry on that list runs outside it today.
Continue Reading
- MCP Server Governance: Enforce at the Client, Not the Registry
- Your MCP Version Pin May Not Freeze Its Dependencies
- Microsoft's MXC Agent Containers Ship Before Intune Can Manage Them
- OpenAI's Agent Kill Switch Failed for 2.5 Hours After a DNS Escape
- Microsoft Entra Warns Sponsors at 60 Days, Disables Agents at 90
- E2B vs Modal vs Daytona: Idle Time Sets Sandbox Bills
