---
title: "Building a safe, effective sandbox to enable Codex on Windows"
description: "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)."
url: "https://swe.quest/articles/building-a-safe-effective-sandbox-to-enable-codex-on-windows-ac8efa0db2521585"
canonical: "https://openai.com/index/building-codex-windows-sandbox"
source: "OpenAI"
published: "2026-05-13"
difficulty: "hard"
kind: "Case study"
reading_minutes: 15
tags: ["sandboxing","ai-coding","security","operating-systems"]
---

# Building a safe, effective sandbox to enable Codex on Windows

A post on [OpenAI](https://swe.quest/sources/openai.md), published 2026-05-13, 15 min read, Case study. Original: [https://openai.com/index/building-codex-windows-sandbox](https://openai.com/index/building-codex-windows-sandbox)

## Summary

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). The first unelevated prototype used synthetic SIDs plus write-restricted tokens and ACLs to confine writes to the workspace. Its network blocking relied only on poisoned proxy environment variables and PATH stubs, which any process could bypass. The current elevated design runs commands as dedicated local users (CodexSandboxOffline/Online) so Windows Firewall rules can block outbound traffic per principal, at the cost of an admin-required setup step that creates users, stores DPAPI-encrypted credentials and installs firewall rules.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Sandboxing & isolation](https://swe.quest/tags/sandboxing.md) (Security)
- [AI for coding](https://swe.quest/tags/ai-coding.md) (AI & ML)
- [Security](https://swe.quest/tags/security.md) (Security)
- [Operating systems](https://swe.quest/tags/operating-systems.md) (Infrastructure)

## Prerequisites

- Windows security model ([easy posts on Security](https://swe.quest/tags/security.md?difficulty=easy))
- access control lists
- process isolation basics ([easy posts on Sandboxing & isolation](https://swe.quest/tags/sandboxing.md?difficulty=easy))

## Keywords

Codex, AppContainer, Windows Sandbox, Mandatory Integrity Control, write-restricted tokens, Windows Firewall, DPAPI, SIDs

## Related posts

- [Inside the Codex sandbox](https://swe.quest/articles/inside-the-codex-sandbox-f3a152d1a955ae56.md): OpenAI · 2026-11-18 · Medium · 23 min read · Sandboxing & isolation, AI agents, AI for coding, Security, Configuration management
  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.
- [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.
- [What is an AI code sandbox?](https://swe.quest/articles/what-is-an-ai-code-sandbox-ff77320ddef8f884.md): Modal · 2025-07-24 · Easy · 9 min read · Sandboxing & isolation, AI agents, AI for coding, Containers
  AI code sandboxes are ephemeral, isolated environments for executing LLM-generated code so hallucinated packages, crashes or prompt-injected exploits can't affect the host or other tenants.

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)
