Skip to content

Codex Desktop launched elevated still spawns medium-integrity shell #25296

Description

@PrzemyslawKlys

What issue are you seeing?

On Windows, Codex Desktop appears to be configured for the elevated Windows sandbox, and the Desktop process is launched with --do-not-de-elevate, but the actual tool shell spawned for agent commands still runs with a filtered medium-integrity token rather than a high-integrity/admin token.

This makes elevated/admin work impossible from the Codex Desktop shell even when the app was opened through UAC and the config requests elevated Windows sandbox behavior.

This is related to, but not the same as:

In this case the sandbox setup refresh is not currently failing before commands run. Commands do run, but the spawned shell is not elevated.

Environment

OS: Windows 11 x64
Codex App: 26.527.3686.0
Install location: C:\Program Files\WindowsApps\OpenAI.Codex_26.527.3686.0_x64__2p2nqsd0c76g0
Shell: C:\Program Files\PowerShell\7\pwsh.exe

Relevant config.toml:

model = "gpt-5.5"
sandbox_mode = "danger-full-access"
approval_policy = "never"

[windows]
sandbox = "elevated"

Process tree

The agent shell is spawned under Codex Desktop like this:

pwsh.exe
  parent: codex.exe app-server --analytics-default-enabled
    parent: Codex.exe ... --do-not-de-elevate

Observed command line for Codex.exe includes:

--do-not-de-elevate

Actual behavior

The shell process is still not elevated.

PowerShell check:

$id = [Security.Principal.WindowsIdentity]::GetCurrent()
$p = [Security.Principal.WindowsPrincipal]$id
[pscustomobject]@{
  User = $id.Name
  IsAdmin = $p.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
  PID = $PID
  Process = (Get-Process -Id $PID).ProcessName
  Integrity = ((whoami /groups | Select-String 'Mandatory Label').Line -replace '^\s+','')
} | Format-List

Observed:

User      : EVOTEC\przemyslaw.klys
IsAdmin   : False
Process   : pwsh
Integrity : Mandatory Label\Medium Mandatory Level

whoami /groups also shows admin groups as filtered/deny-only, for example:

BUILTIN\Administrators    Group used for deny only
EVOTEC\Domain Admins      Group used for deny only
EVOTEC\Enterprise Admins  Group used for deny only
Mandatory Label\Medium Mandatory Level

A protected-path write probe fails:

$path = 'C:\Program Files\codex-elevation-probe.tmp'
try {
  Set-Content -LiteralPath $path -Value 'probe' -ErrorAction Stop
  Remove-Item -LiteralPath $path -Force -ErrorAction Stop
  'ProtectedWrite=SucceededAndRemoved'
} catch {
  'ProtectedWrite=Failed'
  'Error=' + $_.Exception.GetType().FullName
  'Message=' + $_.Exception.Message
}

Observed:

ProtectedWrite=Failed
Error=System.UnauthorizedAccessException
Message=Access to the path 'C:\Program Files\codex-elevation-probe.tmp' is denied.

Sandbox log observations

Current sandbox logs show setup refreshes succeeding and the copied command runner being used:

setup refresh: processed 2 write roots (read roots delegated); errors=[]
codex-windows-sandbox-setup.exe setup binary completed
helper launch resolution: using copied command-runner path C:\Users\przemyslaw.klys.EVOTEC\.codex\.sandbox-bin\codex-command-runner-0.135.0-alpha.1.exe

There is an older stale setup error file from a previous date:

{
  "code": "helper_unknown_error",
  "message": "apply deny-read ACLs"
}

but its timestamp is older than the current successful setup refreshes.

UAC policy checks

EnableLUA                  : 1
ConsentPromptBehaviorAdmin : 5
PromptOnSecureDesktop      : 1
EnableInstallerDetection   : 1

Expected behavior

If Codex Desktop is launched elevated and configured with:

sandbox_mode = "danger-full-access"

[windows]
sandbox = "elevated"

then the shell/tool process used for commands that require administrator rights should either:

  1. run with a high-integrity/admin token, or
  2. clearly report that Codex Desktop cannot provide an elevated command token from this launch path/configuration.

At minimum, danger-full-access plus windows.sandbox="elevated" should not appear successful while command execution still uses a medium-integrity filtered token.

Why this matters

This breaks workflows such as installing MSI packages, modifying services, writing under C:\Program Files, or any other admin-required Windows operation. From the user perspective, UAC was approved and Codex appears to be running with elevated intent, but the actual agent shell cannot perform admin actions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appapp-serverIssues involving app server protocol or interfacesbugSomething isn't workingsandboxIssues related to permissions or sandboxingwindows-osIssues related to Codex on Windows systems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions