More

    OpenAI’s Codex Sandbox Explained: What Agent Permissions Actually Control

    OpenAI’s Codex Sandbox Explained: What Agent Permissions Actually Control

    AI coding tools are becoming more useful because they can do more than suggest code.[1] They can inspect a project, run commands, edit files and, when allowed, reach online services.[1] That usefulness also creates a practical question: what is the agent allowed to touch?[1]

    OpenAI’s Codex sandbox is an attempt to answer that question with explicit limits around files and network access.[1] It is not a magic guarantee that every command is safe, and it is not a replacement for backups or sensible account separation. It is a boundary that can make an agent’s permissions narrower and easier to reason about.[1]

    Person holding the official OpenAI icon
    A person holding the official OpenAI icon. Photo: Wikimedia Commons (CC BY-SA 4.0).

    What the Codex sandbox is designed to do

    OpenAI describes the sandbox as a way for Codex to work inside an existing environment while restricting the filesystem and network resources available to commands.[1] In a simple example, a photo-organising task might be allowed to modify one folder while network access is blocked. A code-review session might be able to read project files and access documentation without being allowed to rewrite the source tree.[1]

    That distinction matters because “the AI can run commands” is too broad to be a useful security policy.[1] The meaningful questions are which paths are writable, which paths are read-only, which destinations are reachable and whether the limits are enforced outside the model’s own instructions.[1]

    The three permission choices worth understanding

    1. Filesystem access

    A permission profile can separate read-only paths from read-write paths.[1] That lets a user keep source code, credentials and configuration files outside the agent’s write boundary while still giving it a designated workspace.[1]

    A safer starting point is a project folder containing a disposable checkout or a branch that can be reviewed before merging.[1] Do not assume that a “workspace” is automatically safe if it contains `.env` files, cloud credentials, SSH keys or production exports.[1] The strongest control is not merely a deny rule; it is also keeping secrets out of the working directory in the first place.[1]

    2. Network access

    OpenAI’s documentation describes profiles that disable network access, allow direct access or route limited access through a policy-aware proxy.[1] No network access is useful for local transformations and tests. A restricted allowlist can be more appropriate when an agent needs documentation or a package registry.[1] Full network access should be treated as a deliberate escalation, not the default shortcut.[1]

    Network restrictions also reduce the chance that a command can upload files or call an unexpected service.[1] They do not prevent every local mistake, and they cannot tell whether a user-approved destination is trustworthy.[1] Review the domains and the data being sent.[1]

    3. Operating-system enforcement

    The point of a sandbox is to enforce limits at the operating-system or harness layer, rather than trusting the model to follow a sentence such as “do not edit this folder.” OpenAI says Codex maps permission profiles to platform-specific controls on macOS, Linux and Windows.[1]

    Microsoft’s Windows Sandbox documentation describes a related but separate feature: a disposable, isolated desktop for testing unknown software, using hypervisor-based virtualisation.[2] That is useful context, but Windows Sandbox is not the same product as the Codex sandbox. One is a disposable virtual machine; the other is an agent execution boundary integrated with a coding harness.[1]

    A practical setup for everyday users

    Start with a copy of the project, not the only copy.[1]

    Keep the agent’s writable path limited to that copy, and make sensitive files read-only or unavailable.[1]

    If the task does not need the internet, disable network access.[1]

    If it does need the internet, begin with the smallest documented allowlist and expand it only when a real task fails.[1]

    Before accepting a change, inspect the diff and the command history.[1] Run tests yourself or in a clean environment.[1] If the agent asks for access to a new directory, a credential, a browser profile or a production endpoint, stop and decide whether that access is truly necessary.[1]

    For a small team, record the permission profile alongside the project instructions.[1] That makes it easier to explain why a task was allowed to read documentation but not upload source files.[1] It also gives the next person a reproducible starting point.[1]

    What the sandbox does not prove

    A sandbox does not prove that generated code is correct, that a dependency is safe, or that a network destination is legitimate.[1] It also does not replace least-privilege accounts, backups, code review, endpoint protection or incident response.[1] The right mental model is “one layer in a defence-in-depth system,” not “the agent is now harmless.”[1]

    For more practical streaming-device setup, see Honest Fred’s complete ONN 4K Google TV setup guide.[1] The subject is different, but the principle is similar: configure the device or tool deliberately instead of accepting every default.[1]

    Bottom line

    The Codex sandbox is most useful when its boundaries match the task.[1] Give an agent a disposable workspace, keep secrets outside it, disable network access when it is unnecessary and review every request to widen permissions.[1] That will not make AI coding risk-free, but it turns a vague trust decision into a set of controls you can inspect.[1]

    Current-date note: this article reflects the OpenAI and Microsoft documentation reviewed on November 30, 2026. Product names, defaults and platform support can change; check the current documentation before changing a production workflow.

    Sources

    [1] Primary source: https://openai.com/index/inside-the-codex-sandbox — Inside the Codex sandbox | OpenAI [2] Additional source: https://learn.microsoft.com/en-us/windows/security/application-security/application-isolation/windows-sandbox/windows-sandbox-overview — Windows Sandbox | Microsoft Learn

    Latest articles

    spot_imgspot_img

    Related articles

    Leave a reply

    Please enter your comment!
    Please enter your name here

    spot_imgspot_img