13requiring WSL or a virtual machine. This keeps Codex in Windows-native13requiring WSL or a virtual machine. This keeps Codex in Windows-native
14workflows while enforcing bounded filesystem and network permissions.14workflows while enforcing bounded filesystem and network permissions.
15 15
16For enterprise installation, see the [Windows Deployment Guide](https://learn.chatgpt.com/docs/enterprise/windows-deployment).
17
16 18
17 19
18 20
34 36
35Codex supports three Windows sandbox implementations:37Codex supports three Windows sandbox implementations:
36 38
37- `mxc`: The recommended sandbox on compatible Windows devices where policy permits it. Uses process isolation without administrator-approved setup, additional Windows accounts, changes to host file permissions, or local firewall rules.39- `mxc`: The recommended sandbox on compatible Windows devices. Uses native process isolation without administrator-approved setup, additional Windows accounts, or local firewall rules.
38- `elevated`: The preferred legacy fallback when MXC is unavailable or disabled. Requires administrator-approved setup. Commands in the sandbox run without administrator privileges.40- `elevated`: The preferred legacy fallback when MXC is unavailable or disabled. Requires administrator-approved setup. Commands in the sandbox run without administrator privileges.
39- `unelevated`: A legacy fallback when elevated setup is unavailable and organizational policy permits it. Has weaker network isolation than `elevated` and doesn't support denied read paths.41- `unelevated`: A legacy fallback when elevated setup is unavailable and organizational policy permits it. Has weaker network isolation than `elevated` and doesn't support denied read paths.
40 42
44 46
45## Configure the Windows sandbox47## Configure the Windows sandbox
46 48
47The Windows sandbox enforces the active filesystem and network permissions for49The Windows sandbox enforces the active filesystem and network permissions for commands and their child processes. The permission profile determines which paths are readable or writable and whether network access is allowed. Approval policy separately controls when Codex asks to run commands with more access. See [sandbox and approvals](https://learn.chatgpt.com/docs/agent-approvals-security).
48commands and their child processes. The permission profile determines which50
49paths are readable or writable and whether network access is allowed. Approval51
50policy separately controls when Codex asks to run commands with more access.52
51See [sandbox and approvals](https://learn.chatgpt.com/docs/agent-approvals-security).
52 53
53### Control MXC rollout
54 54
55These settings are available in Codex CLI 0.162.0. In the standalone CLI,55### Enable MXC
56`features.prefer_mxc` is off by default. The desktop app can enable this
57preference through its rollout configuration.
58 56
59#### Prefer MXC with legacy fallback57The desktop app automatically prefers MXC for consumer accounts when the device supports it. For enterprise deployments or standalone CLI use, you can enable the same behavior with the configuration below.
60 58
61To use MXC when the device and policy support it, add this to `config.toml`:59In `config.toml`:
62 60
63```toml61```toml
64[features]62[features]
65prefer_mxc = true63prefer_mxc = true
66```64```
67 65
68Keep `windows.sandbox` set to your organization's permitted legacy implementation,66With `prefer_mxc = true`, Codex uses MXC for Windows commands when the device and policy support it.
69`elevated` or `unelevated`, for fallback.67Otherwise, it uses the existing legacy selection and setup flow.
70 68
71Codex uses MXC for local Windows commands when the device and policy support it,69For enterprises where device support or policy varies, keep `windows.sandbox` set to your organization's permitted legacy implementation, `elevated` or `unelevated`, [as a fallback](#configure-a-legacy-fallback).
72even when `windows.sandbox` selects a legacy implementation. Otherwise, it uses
73the existing legacy selection and setup flow. This includes devices without
74MXC support and policies that set `windows.allow_mxc = false` or forbid local
75binding. `windows.allowed_sandbox_implementations` still constrains fallback;
76permission profiles and other managed requirements continue to apply.
77 70
78Fallback happens during sandbox selection. Commands that fail after MXC is71Administrators can distribute this configuration as a default or enforce `features.prefer_mxc = true` through `requirements.toml`. Both permit legacy fallback. See [managed configuration](https://learn.chatgpt.com/docs/enterprise/managed-configuration) for how defaults and requirements differ.
79selected aren't retried in a legacy sandbox.
80 72
81Administrators can distribute this configuration as a default or enforce73### Keep MXC disabled
82`features.prefer_mxc = true` through `requirements.toml`. Both permit legacy
83fallback. See [managed configuration](https://learn.chatgpt.com/docs/enterprise/managed-configuration)
84for how defaults and requirements differ.
85
86#### Keep MXC disabled
87 74
88To prevent MXC use in your organization, add this to your managed75To prevent MXC use in your organization, add this to your managed
89`requirements.toml`:76`requirements.toml`:
93allow_mxc = false80allow_mxc = false
94```81```
95 82
96This blocks both automatic MXC selection and explicit `windows.sandbox = "mxc"`.83This blocks both automatic MXC selection and explicit `windows.sandbox = "mxc"`. Existing legacy sandbox settings and requirements still apply.
97Existing legacy sandbox settings and requirements still apply. Configure
98`windows.allow_mxc` in `requirements.toml`, not `config.toml`.
99 84
100### MXC compatibility85### MXC compatibility
101 86
102Microsoft Execution Containers (MXC) uses native Windows process isolation87The host must already have the required Microsoft Execution Containers (MXC) capabilities, which Microsoft is rolling out to Windows 11 devices. Microsoft introduced MXC process isolation in **Windows 11 24H2 (build 26100.9278)** and **25H2 (build 26200.9278)**. Use the command below to verify MXC support on your device.
103without creating sandbox accounts, changing host file permissions, or running
104the classic elevated setup. Commands run under the user's Windows identity
105with a policy applied to each command. MXC doesn't require administrator
106elevation for sandbox setup or local Windows Firewall rules.
107MXC accepts readable, writable, and denied paths from the active permission
108profile. Its native network policy controls command network access without
109depending on the legacy sandbox's firewall provisioning.
110
111Before selecting MXC, validate the required capabilities and your workloads on
112the Windows 11 device. A Windows version number alone doesn't establish
113compatibility.
114 88
115In Codex CLI 0.162.0, you can test MXC for one command without changing the saved89In Codex CLI 0.162.0 and later, you can test MXC for one command without changing the saved sandbox selection. From your project directory, run:
116sandbox selection. From your project directory, run:
117 90
118```powershell91```powershell
119codex -c windows.sandbox=mxc sandbox --include-managed-config --permission-profile :workspace -- cmd.exe /d /c echo MXC_OK92codex -c windows.sandbox=mxc sandbox --include-managed-config --permission-profile :workspace -- cmd.exe /d /c echo MXC_OK
120$LASTEXITCODE93$LASTEXITCODE
121```94```
122 95
123Expected output is `MXC_OK` and exit code `0`. This checks command startup with96Expected output is `MXC_OK` and exit code `0`. This checks command startup with the workspace permission profile and managed requirements.
124the workspace permission profile and managed requirements. Also test permitted
125file access, expected denials, PowerShell, and your network policy before using
126MXC for normal work.
127 97
128Explicit `windows.sandbox = "mxc"` selection fails if the required native98Explicit `windows.sandbox = "mxc"` selection fails if the required native capabilities are unavailable or policy blocks MXC.
129capabilities are unavailable; it doesn't fall back to a classic implementation.
130Policies with denied paths also require native deny-path support.
131 99
132Check these compatibility limits:100Note these compatibility limits:
133 101
134- Managed networking requires effective `allow_local_binding = true`. MXC102- Managed networking requires effective `allow_local_binding = true`. MXC permits connections to and from services on host loopback. Proxy domain rules still apply to proxied traffic, but the proxy's additional private-network destination checks are removed.
135 permits connections to and from services on host loopback. Proxy domain rules103- Remaining child processes stop when the foreground command exits. Test workflows that rely on detached development servers.
136 still apply to proxied traffic, but the proxy's additional private-network
137 destination checks are removed. This doesn't enable networking when it's disabled.
138- Remaining child processes stop when the foreground command exits. Test
139 workflows that rely on detached development servers.
140 104
141### Configure a legacy fallback105### Configure a legacy fallback
142 106
147sandbox = "elevated" # or "unelevated"111sandbox = "elevated" # or "unelevated"
148```112```
149 113
150`elevated` is the preferred legacy fallback. It uses dedicated114`elevated` is the preferred legacy fallback. It uses dedicated lower-privilege sandbox users, filesystem permission boundaries, firewall rules, and local policy changes needed for commands that run in the sandbox.
151lower-privilege sandbox users, filesystem permission boundaries, firewall
152rules, and local policy changes needed for commands that run in the sandbox.
153 115
154`unelevated` is a legacy fallback. It runs commands with a116`unelevated` is a legacy fallback. It runs commands with a restricted Windows token derived from your current user, applies ACL-based filesystem boundaries, and uses environment-level offline controls instead of the dedicated offline-user firewall rule. It provides weaker network isolation than `elevated` and doesn't support denied read paths, but is still useful when administrator-approved setup is blocked by local or enterprise policy.
155restricted Windows token derived from your current user, applies ACL-based
156filesystem boundaries, and uses environment-level offline controls instead of
157the dedicated offline-user firewall rule. It provides weaker network isolation
158than `elevated` and doesn't support denied read paths, but is still useful when
159administrator-approved setup is blocked by local or enterprise policy.
160 117
161Use MXC when the device and policy support it. Otherwise, prefer `elevated`.118Use MXC when the device and policy support it. Otherwise, prefer `elevated`, with `unelevated` as a secondary fallback.
162Use `unelevated` as a fallback only when your organization's policy permits it.
163 119
164Enterprise administrators can constrain which classic sandbox implementations120Enterprise administrators can constrain which legacy sandbox implementations
165Codex can use through [`requirements.toml`](https://learn.chatgpt.com/docs/enterprise/managed-configuration#admin-enforced-requirements-requirementstoml):121Codex can use through [`requirements.toml`](https://learn.chatgpt.com/docs/enterprise/managed-configuration#admin-enforced-requirements-requirementstoml):
166 122
167```toml123```toml
169allowed_sandbox_implementations = ["elevated"]125allowed_sandbox_implementations = ["elevated"]
170```126```
171 127
172This example permits `elevated` and prevents fallback to `unelevated`. It does128This example permits `elevated` and prevents fallback to `unelevated`. It does not restrict `mxc` when MXC is available. Other managed permission and network requirements still apply. To permit either legacy implementation, include both values; Codex prefers `elevated` when no mode is selected.
173not restrict `mxc` when MXC is available. Other managed permission and network129
174requirements still apply. To permit either classic implementation, include130See the [`requirements.toml` reference](https://learn.chatgpt.com/docs/config-file/config-reference#requirementstoml) for the supported values. To block MXC as well, use the separate [`windows.allow_mxc` requirement](#keep-mxc-disabled).
175both values; Codex prefers `elevated` when no mode is selected. See the
176[`requirements.toml` reference](https://learn.chatgpt.com/docs/config-file/config-reference#requirementstoml) for
177the supported values. To block MXC as well, use the separate
178[`windows.allow_mxc` requirement](#keep-mxc-disabled).
179 131
180By default, both legacy sandbox modes also use a private desktop for stronger UI132By default, both legacy sandbox modes also use a private desktop for stronger UI isolation.
181isolation.
182 133
183#### Provision the classic elevated sandbox134### IT-led provisioning for the legacy elevated sandbox
184 135
185For employees without local administrator rights, IT can install the CLI and136For employees without local administrator rights, IT can install the CLI and provision the elevated sandbox before the employee starts Codex. From an elevated
186provision the sandbox before the employee starts Codex. From an elevated
187deployment process, run:137deployment process, run:
188 138
189```powershell139```powershell
190codex sandbox setup --elevated --user 'DOMAIN\alice' --codex-home 'C:\Users\alice\.codex'140codex sandbox setup --elevated --user 'DOMAIN\alice' --codex-home 'C:\Users\alice\.codex'
191```141```
192 142
193Replace the identity and path with the employee's Windows identity and143Replace the identity and path with the employee's Windows identity and `CODEX_HOME`. The command reads that user's configuration, provisions the sandbox, and saves `windows.sandbox = "elevated"`. The employee then runs Codex from a normal terminal.
194`CODEX_HOME`. The command reads that user's configuration, provisions the
195sandbox, and saves `windows.sandbox = "elevated"`. The employee then runs Codex
196from a normal terminal. Using a non-admin terminal doesn't select the
197`unelevated` implementation.
198 144
199### Sandbox permissions145### Sandbox permissions
200 146
219 165
220- `winget` should be available. If it's missing, update Windows or install166- `winget` should be available. If it's missing, update Windows or install
221 the Windows Package Manager before setting up Codex.167 the Windows Package Manager before setting up Codex.
222- The classic `elevated` sandbox depends on administrator-approved setup.168- The legacy `elevated` sandbox depends on administrator-approved setup.
223- Some enterprise-managed devices block the required setup steps even when the169- Some enterprise-managed devices block the required setup steps even when the
224 OS version itself is acceptable.170 OS version itself is acceptable.
225- MXC additionally requires the native capabilities described in171- MXC additionally requires the native capabilities described in
385 331
3861. Restart Codex.3321. Restart Codex.
3872. For MXC, repeat the [compatibility probe](#mxc-compatibility) and check the3332. For MXC, repeat the [compatibility probe](#mxc-compatibility) and check the
388 effective network policy. For the classic `elevated` implementation, try334 effective network policy. For the legacy `elevated` implementation, try
389 sandbox setup again.335 sandbox setup again.
3903. If a classic sandbox is needed and managed policy permits it, use3363. If a legacy sandbox is needed and managed policy permits it, use
391 `unelevated` as a temporary fallback.337 `unelevated` as a temporary fallback.
3924. Collect the sandbox log for review.3384. Collect the sandbox log for review.
393 339