---
title: "Inside the Codex sandbox"
description: "Codex sandboxes agent-run commands in the user's own environment by using each OS's native sandboxing facilities rather than VMs or containers, so native toolchains like Xcode and the iOS simulator keep working."
url: "https://swe.quest/articles/inside-the-codex-sandbox-f3a152d1a955ae56"
canonical: "https://openai.com/index/inside-the-codex-sandbox"
source: "OpenAI"
published: "2026-11-18"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 23
tags: ["sandboxing","ai-agents","ai-coding","security","configuration"]
---

# Inside the Codex sandbox

A post on [OpenAI](https://swe.quest/sources/openai.md), published 2026-11-18, 23 min read, Deep dive. Original: [https://openai.com/index/inside-the-codex-sandbox](https://openai.com/index/inside-the-codex-sandbox)

## Summary

Codex sandboxes agent-run commands in the user's own environment by using each OS's native sandboxing facilities rather than VMs or containers, so native toolchains like Xcode and the iOS simulator keep working. The default :workspace profile allows writes inside the workspace but keeps .git and .codex read-only, allows broad reads, and disables network access. That still leaves risks such as tampering with ignored node\_modules, which is why OpenAI treats the sandbox as one layer of defense in depth. The post covers the cross-platform spawn API, per-command permission escalation in the exec\_command tool, TOML permission profiles with filesystem and domain rules, a network proxy, and layered enterprise managed requirements, before describing enforcement on macOS, Linux and Windows.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Sandboxing & isolation](https://swe.quest/tags/sandboxing.md) (Security)
- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [AI for coding](https://swe.quest/tags/ai-coding.md) (AI & ML)
- [Security](https://swe.quest/tags/security.md) (Security)
- [Configuration management](https://swe.quest/tags/configuration.md) (Reliability & operations)

## Prerequisites

- process sandboxing concepts ([easy posts on Sandboxing & isolation](https://swe.quest/tags/sandboxing.md?difficulty=easy))
- Unix file permissions
- coding agent tool calls

## Keywords

Codex, permission profiles, config.toml, requirements.toml, network proxy, codex sandbox

## Related posts

- [Running Codex safely at OpenAI](https://swe.quest/articles/running-codex-safely-at-openai-ba7fb69d40cdeaed.md): OpenAI · 2026-05-08 · Medium · 5 min read · AI agents, Sandboxing & isolation, AI for coding, Configuration management, Observability
  OpenAI runs Codex internally inside a bounded environment. A sandbox limits where it can write and whether it can reach the network, approval policies make higher-risk actions stop for review, and an auto-review subagent approves routine low-risk requests so users are not constantly interrupted.
- [Sandboxing](https://swe.quest/articles/sandboxing-a1efb1bf6e8282ad.md): Zed · 2026-08-05 · Medium · 7 min read · Sandboxing & isolation, AI agents, AI for coding, Linux, Developer tools
  Zed's agent panel now sandboxes the terminal and fetch tools by default (from 1.14) using OS-enforced restrictions: Seatbelt on macOS, Bubblewrap namespaces on Linux, and WSL on Windows.
- [Making Claude Code safer with sandboxing](https://swe.quest/articles/making-claude-code-safer-with-sandboxing-927e34fb9dfe9ca9.md): Anthropic Engineering · 2025-10-20 · Medium · 5 min read · Sandboxing & isolation, AI agents, AI for coding, Security
  Claude Code now sandboxes its bash tool using OS-level primitives (Linux bubblewrap, macOS seatbelt) to enforce filesystem isolation (writes limited to the working directory) and network isolation (traffic forced through a Unix domain socket to an external proxy that allowlists domains), covering all spawned subprocesses.
- [Building a safe, effective sandbox to enable Codex on Windows](https://swe.quest/articles/building-a-safe-effective-sandbox-to-enable-codex-on-windows-ac8efa0db2521585.md): OpenAI · 2026-05-13 · Hard · 15 min read · Sandboxing & isolation, AI for coding, Security, Operating systems
  Codex on Windows lacked an OS-level sandbox, so OpenAI built one from Windows primitives after rejecting AppContainer (too narrowly scoped for open-ended dev workflows), Windows Sandbox (separate VM, unavailable on Home SKUs) and Mandatory Integrity Control labels (turns the workspace into a low-integrity sink).
- [Why AI Agents Need Isolation](https://swe.quest/articles/why-ai-agents-need-isolation-2e7b1a6342af3236.md): Docker · 2026-07-01 · Easy · 9 min read · Sandboxing & isolation, AI agents, Virtualization, Containers, AI for coding
  AI coding agents that run commands, install packages and handle credentials should execute behind an isolation boundary rather than directly on the developer's host.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
