OpenAI published a technical deep dive on November 18, 2026 explaining how the Codex sandbox constrains the shell commands its coding agent runs on your Mac, Linux PC, or Windows machine. Member of Technical Staff Michael Bolin argues Codex should stay in your existing environment — not inside a disposable container — while permission profiles you control cap filesystem and network reach.
The post lands one day after Prime Radiant's external sandbox pattern showed the community experimenting with routing agent Bash into isolated Linux guests. OpenAI's answer is the opposite axis: invest in OS sandboxes so Codex can compile iOS apps, talk to local simulators, and reuse host SDKs. Both schools matter because prompt-injected commands and poisoned dependencies keep showing up in real incidents.
What problem the Codex sandbox tries to solve
Codex's most sensitive tool is the shell: it runs programs with your user account's reach. OpenAI's stated philosophy is defense in depth — alignment training plus harness controls — because a model that wants to help can still execute a harmful command.
A sandbox, in OpenAI's wording, is a runtime boundary on what a child process may touch. Examples from the post:
| Task | Profile idea | Risk being managed |
|---|---|---|
| Photo organizer | Read/write only ~/Pictures, network off | Uploading private images |
| Code review | Docs sites allowed, repo read-only | Exfiltrating source through curl |
| Everyday repo work | :workspace defaults | Accidental secret reads outside the repo |
OpenAI is explicit that defaults are conservative but not airtight. Even with :workspace, a command could patch a local node_modules/prettier copy. Your editor might run that binary on save outside Codex's sandbox, executing malware without showing up in git status. That is why the article pairs sandboxing with auto-review and training rather than treating profiles as a guarantee.
Default boundaries: the :workspace profile
The built-in :workspace profile encodes three rules OpenAI wants every Git project to inherit:
- Writes inside the workspace, with
.gitand.codexread-only so agents cannot rewrite hooks orconfig.tomlsilently. - Broad read access wherever your OS user already has permission — needed for compilers pulling system headers, but also meaning
~/.aws/credentialsmay be readable. - Network disabled unless you widen the profile or approve a one-off escalation.
That third point is the main lever for blocking credential exfiltration. Downloads fail until you allow domains or switch to :danger-full-access, which OpenAI documents for the rare cases you truly need raw network.
Permission profiles in config.toml
Named profiles live under [permissions] in config.toml. OpenAI's sample dev profile extends :workspace, adds a writable ~/build-cache, keeps .vscode and .devcontainer read-only via the :workspace_roots table, and denies **/*.env plus a secrets folder.
Network has three modes in the post:
- Off (default for
:workspace) - Direct full access (
:danger-full-access) - Proxy with domain rules — Codex runs
codex-network-proxy, injects standardHTTP_PROXYvariables, and resolves DNS only after policy allows the hostname (to block DNS exfiltration)
Enterprise admins can layer requirements.toml or cloud requirements to expose only :read-only and ban :danger-full-access. That mirrors how Microsoft Foundry customers ask for spend and policy guardrails — but here the guardrail is which syscall and socket families survive.
Agent sandbox testing concept for OpenAI Codex permission profiles on the host machine
How the harness runs commands
OpenAI ties sandboxing to the exec_command tool described in its Unrolling the Codex Agent Loop companion post. The harness calls spawn_command_under_sandbox() with a PermissionProfile and optional NetworkProxy, then keeps the entire process tree inside the same restrictions — important when build scripts spawn grandchildren.
Escalation is explicit: tool calls can request with_additional_permissions inside the sandbox or require_escalated execution outside it. Codex may prompt you or route through auto-review before honoring either path. That design parallels ScoutCode's permission modes, but OpenAI documents OS enforcement in far more detail than most harness READMEs.
The codex sandbox CLI for your own tools
Beyond Codex itself, the codex sandbox subcommand runs arbitrary programs under a profile. OpenAI's malicious Prettier example attempts to write .vscode/settings.json pointing at ./node_modules/evil-prettier; a read-only .vscode entry blocks the write and demonstrates how to regression-test profiles.
The same mechanism powers MCP installs: cache npx @modelcontextprotocol/server-memory with temporary network, then run the server read-only with network off and writes limited to cache and data dirs. If you orchestrate agents with Loops or custom CI, this CLI is the supported way to mirror Codex's boundaries.
Platform implementations
Permission boundary graphic for OS-native Codex sandbox enforcement on macOS, Linux, and Windows
macOS: Seatbelt and sandbox-exec
Codex generates Sandbox Profile Language snippets and invokes /usr/bin/sandbox-exec. (deny default) is the base; explicit (allow network-outbound ...) opens only the local proxy ports. OpenAI notes Apple marks sandbox-exec deprecated yet Chrome and Chromium still rely on Seatbelt, so Codex plans to keep using it.
Linux: bubblewrap plus seccomp-bpf
codex-linux-sandbox wraps bubblewrap for mount namespaces, then applies seccomp-bpf compiled through the seccompiler crate. Deny globs expand to concrete paths per command — new files matching a glob mid-run are not auto-blocked, a subtle limitation red teams should remember.
When the network proxy is on, Codex forks a host bridge that accepts connections from an isolated network namespace and relays them to the shared proxy — more moving parts than macOS loopback, but necessary because bubblewrap unshares the network stack.
Windows: moving to MXC
OpenAI says it is replacing its older Windows sandbox with Microsoft's MXC (Microsoft eXecution Container) to drop admin-setup friction, slow ACL churn, and persistent firewall artifacts. MXC support is the forward path; legacy Windows behavior still appears in older docs.
Enterprise rollout checklist
OpenAI's post targets security engineers rolling Codex to hundreds of laptops the same week GPT-6.2 expanded coding use cases. A practical sequence:
- Inventory default profiles. Ensure no developer pinned
:danger-full-accessin a globalconfig.tomlleft over from debugging. - Publish requirements.toml before Christmas travel season, when contractors clone repos onto personal Macs.
- Deny env files centrally. Extend OpenAI's
**/*.envdeny pattern to**/.aws/**and**/id_rsaif your threat model includes cloud keys beside dotenv files. - Enable proxy mode for CI mirrors. Allow
*.ubuntu.comand your artifact registry hosts while blocking paste sites and raw IP endpoints. - Log escalations. Every
require_escalatedapproval is an audit event; feed those logs to the same SIEM watching GitHub Copilot routing.
OpenAI also documents managed requirements merging: arrays replace wholesale, tables merge recursively. That means your security team can add a single ".idea" = "read" row without forking the entire corporate baseline — important when IT refreshes profiles monthly.
Windows MXC migration notes
Teams on Surface fleets should read the MXC section twice. OpenAI admits the legacy Windows sandbox needed admin setup, slow ACL writes, and leftover firewall rules. MXC is supposed to shrink that operational tax. Until your tenant receives MXC builds, treat Windows Codex like any other partially sandboxed agent: pair it with EDR policies that watch for unexpected child processes.
How this compares to external sandboxes
| Approach | Where the agent runs | Isolation strength | Workflow fit |
|---|---|---|---|
| Codex OS sandbox | Host harness | Kernel policies on real files | Best for native mobile builds |
| Docker-all-in | Container | Strong, fragile toolchains | Datacenter reproducibility |
| Prime Radiant external sandbox | Host harness, Linux guest for Bash | Clear audit split | Experimental, unaudited |
None of these replace code review and secret hygiene. They reduce blast radius when a model hallucinates curl exfiltration, not when a human pastes production keys into the repo.
What developers are saying
The Hacker News thread is thin so far — bolinfest (likely Bolin) posted that the article is a deep dive on the sandbox component. Watch the thread for hands-on reports on bubblewrap versus distro packages and whether broad read defaults feel too loose for regulated laptops.
What to do next
- Read OpenAI's Codex security cookbook alongside this post.
- Copy the
devprofile pattern, deny**/*.env, and runcodex sandboxtests on your worst-case scripts. - If you need Linux-in-a-box isolation anyway, pair host Codex with external sandbox servers — they are complementary, not either-or.
- Enterprises should publish requirements.toml before rolling Codex to hundreds of laptops, the same week you rationalize API key storage for agents.
For builders comparing harnesses, our GPT-6.2 launch coverage and Claude remote-access debate sit on the same security shelf: models got better, so execution policy is the product.
Quick answers to common Codex sandbox searches
| Search intent | Short answer |
|---|---|
| Codex sandbox mode | Permission profiles in config.toml, not a separate VM product |
| Codex disable sandbox | Profiles like :danger-full-access exist but enterprises can ban them via requirements |
| Codex vs Claude Code | Both run on host filesystems; compare their escalation prompts and enterprise policy files, not marketing slides |
| Is Codex open source? | The harness is not fully open; OpenAI documents behavior in engineering posts like this one |
If codex sandbox tests pass but production still scares you, run a parallel Loops workflow against a scratch repo before pointing Codex at monorepo mains. The CLI is the supported contract — reverse-engineering undocumented flags will break on the next CLI release.
OpenAI ends the engineering post with acknowledgments to contributors who built codex-linux-sandbox and the network proxy crate. If you maintain an internal fork of Codex tooling, track those component names in your SBOM — they are the surfaces your red team should fuzz first.
