subagentic.ai RSS X YouTube GitHub
AI-generated illustration

News

OpenAI shows how the Codex sandbox limits local commands

OpenAI explains how Codex runs local commands inside filesystem and network limits on macOS, Linux, and Windows, without a container.

codexopenaisandboxagent-security

On November 18, 2026, OpenAI published “Inside the Codex sandbox,” an engineering post by Michael Bolin, Member of Technical Staff. It explains how Codex already runs commands on a developer’s machine inside filesystem and network limits the user can set. The piece is a design account of the sandbox in use today, not the launch of a new isolation product.

The same day, Bolin wrote that ensuring Codex runs with proper safeguards has been “top of mind” for him since the beginning, and that he was “excited to (finally!) share how it all works.”

Codex does not move that work into a virtual machine or a container. The post treats both as popular ways to sandbox a program, then describes a different choice: constrain commands in the user’s existing environment with each platform’s own sandbox facilities. One API covers macOS, Windows, and Linux. It takes a command and a permission profile. If the profile allows only limited network access, the caller must also supply a network proxy. Each child process inherits its parent’s constraints, including descendants that outlive the original command.

The practical argument is the developer’s machine itself. Reproducing a laptop in Docker can take work, and some workflows still depend on host tools. The post’s example is an iOS app on a Mac. Inside Docker, Codex could not run the native Mac build toolchain or launch the iPhone simulator. Sending those steps back to the host would execute them outside the container, where they would need restrictions of their own. Codex’s preference is OS-specific sandboxing, so the agent can run where the task already lives.

What :workspace still reaches

Users configure the Codex sandbox through permission profiles, which define filesystem and network restrictions for a session. With a Git repository as the workspace root, the built-in :workspace profile is the conservative default that still aims to allow ordinary work.

Writes are allowed inside the workspace. Directories such as .git and .codex stay read-only, so Codex can edit source without asking for every change, while direct edits to .codex/config.toml or to hooks under .git/hooks are blocked. Rules inherited from :workspace also keep .agents and .aws read-only under each workspace root. The Codex CLI treats its working directory as the sole workspace root; the ChatGPT desktop app uses the project’s source folders.

Reads are broad, limited by the user’s existing operating-system permissions. Compilers, runtimes, and build tools depend on SDKs, libraries, and configuration outside the repository. Cutting reads off at the workspace boundary would break many ordinary workflows. OpenAI’s stated tradeoff is that sensitive files elsewhere on the machine may remain readable, including config files that contain API keys.

Network access is disabled. That blocks direct uploads to external services, including attempts to exfiltrate data the command can read. It also blocks legitimate operations such as downloading dependencies, which require additional access.

Those rules prevent a large class of bad behavior. They do not make harmful actions impossible. The post’s example is an edit to a locally installed package such as node_modules/prettier. The change might not show up in git status, because node_modules is often ignored by Git. If the editor runs that copy of Prettier on save, saving a file could execute the malicious code outside the Codex sandbox. OpenAI treats that gap as a reason for defense in depth: the sandbox limits access, while training and alignment are meant to keep the model’s use of that access aligned with the user’s intent.

Asking for more is not the same as getting it

The shell tool can request a different mode for a single command. The harness decides whether to grant it, based on the user’s preferences. It may prompt the user directly, or route the request to auto-review.

use_default keeps the sandbox config for the turn. with_additional_permissions asks to expand filesystem or network access while staying inside the sandbox. require_escalated asks to run outside it. Only if execution is authorized does the harness pass the matching permission profile and, when needed, a network proxy. The same sandbox path is also used when the harness reads or modifies local files.

Named profiles, stored under [permissions] in config.toml, can extend :workspace and mark paths read, write, or deny. Network policy falls into three rough options: no network, the :workspace default; full direct access, the default for :danger-full-access; or access only through a proxy, whose domain rules support exact names and wildcards, with explicit deny rules taking precedence. Enterprise administrators can further constrain choices with managed requirements, including which profiles a user may select. The post’s example sets the default to :read-only and marks :danger-full-access unavailable.

Outside an agent session, codex sandbox runs a command under a chosen profile. The post uses it to show a write into a read-only .vscode directory failing on macOS with “Operation not permitted.” A stdio MCP server started from config is not sandboxed by the harness by default: Codex cannot reliably infer which files or network services that server needs.

The line the operating system draws

Those limits are operating-system restrictions, not a separate machine. When network access is limited, the harness starts a proxy, allows connections to it, and blocks direct connections to external hosts. The shared proxy starts HTTP and SOCKS5 listeners by default. It resolves a hostname only after the request is allowed or approved, because a DNS lookup can leak information encoded in the name. Broad wildcard rules, or access to DNS services, can still permit DNS-based exfiltration. On macOS, Codex uses Seatbelt through /usr/bin/sandbox-exec, starting from a default deny. The man page marks that command deprecated; OpenAI says macOS still ships Seatbelt profiles, that Chrome and Chromium still rely on Seatbelt, and that Codex plans to keep using it. On Linux, codex-linux-sandbox combines bubblewrap with seccomp-bpf filters the process tree inherits. The post also examines how Windows enforces a permission profile.

Read the November 18 engineering post for the Windows section, the permission-profile syntax, and the proxy’s domain rules. If you run Codex, test a profile with codex sandbox before you trust the boundary—the post presents that command as the way to confirm a write is actually blocked. For organization-wide defaults, start from the managed-requirements example in the article and the Codex security cookbook it points to.

Sources