Skip to content

[Windows][Codex App/CLI] Sandboxed native directory traversal fails with ACCESS DENIED (WinError 5), while Full Access works #53174

Open

Description

@RJKRanathunga

What version of the Codex App are you using (From “About Codex” dialog)?

Version 26.1007.21434

What subscription do you have?

Not provided

What platform is your computer?

Microsoft Windows NT 10.0.26300.0 x64

What issue are you seeing?

Summary

Codex Desktop on Windows fails to execute native filesystem directory changes inside its normal Workspace Write sandbox, even when the target directory is readable and belongs to an authorized workspace.

The same operations succeed immediately when switching Codex to Full Access.

This is not specific to Flutter. The problem affects CMD, Git, and the Windows native current-directory API. Flutter and Dart failures are downstream consequences.

Actual behavior

Inside Codex with Workspace Write permissions:

Test 1 — Native CMD directory access

cmd.exe /d /c "cd /d C:\Tools\flutter && cd"

Result:

Access is denied.
Exit code: 1

Test 2 — Native CMD access to an existing project workspace

cmd.exe /d /c "cd /d D:\Projects\<workspace> && cd"

Result:

Access is denied.
Exit code: 1

Test 3 — Git repository access

git -C C:\Tools\flutter rev-parse HEAD

Result:

fatal: cannot change to 'C:\Tools\flutter': Permission denied
Exit code: 1

Test 4 — Windows native current-directory API

[System.IO.Directory]::SetCurrentDirectory('C:\Tools\flutter')

Result:

MethodInvocationException:
Exception calling "SetCurrentDirectory" with "1" argument(s):
"Access to the path 'C:\Tools\flutter' is denied."

PowerShell can access the same directory

Interestingly, these operations succeed inside the same sandbox:

Get-ChildItem -LiteralPath 'C:\Tools\flutter' -Name

Set-Location -LiteralPath 'C:\Tools\flutter'

Get-Content -LiteralPath 'C:\Tools\flutter.git\HEAD' -TotalCount 1

Git itself launches correctly:

git version 2.56.0.windows.2

This suggests that ordinary filesystem reading works, while native directory-handle operations fail.

Impact on Flutter development

Running flutter --version inside Codex produces:

fatal: cannot change to 'C:\Tools\flutter': Permission denied

Invoke-Expression:
C:\Tools\flutter\bin\internal\update_engine_version.ps1:62

You cannot call a method on a null-valued expression.

Error: Unable to determine engine version...

Some Flutter and Dart commands also hang until manually terminated.

However, Flutter, Dart, Git, and native CMD directory changes work correctly outside Codex and in Full Access mode.

Process Monitor evidence

Microsoft Sysinternals Process Monitor captured the exact filesystem failures.

First denial — Codex's bundled PowerShell runtime

Process: cmd.exe
Operation: CreateFile

Path:
C:\Users&lt;USER>.cache\codex-runtimes
codex-primary-runtime\dependencies\native\powershell

Result: ACCESS DENIED

Desired Access: Execute/Traverse, Synchronize
Disposition: Open
Options: Directory, Synchronous IO Non-Alert

Second denial — Flutter SDK

Process: cmd.exe
PID: 23544
Operation: CreateFile
Path: C:\Tools\flutter

Result: ACCESS DENIED

Desired Access: Execute/Traverse, Synchronize
Disposition: Open
Options: Directory, Synchronous IO Non-Alert

The captured process sequence:

codex.exe
|
v
pwsh.exe
|
v
cmd.exe
|
v
CreateFile(C:\Tools\flutter)
|
v
ACCESS DENIED (WinError 5)

The first access denial involves Codex's own runtime directory, before the Flutter SDK denial.

Therefore, this is not merely a missing Flutter SDK permission.

ProcMon establishes the denied access request but does not identify the precise Windows security rule responsible.

Full Access comparison

Running the identical tests in Codex Full Access mode:

Command Workspace Write Full Access
CMD change to project directory FAIL PASS
CMD change to Flutter SDK FAIL PASS
Git read Flutter revision FAIL PASS
flutter --version FAIL PASS
dart --version FAIL PASS
flutter analyze execution FAIL / timeout Completes

In Full Access, Flutter 3.47.7 and Dart 3.13.5 initialize normally. Static analysis also completes; separate missing-dependency diagnostics are unrelated to this sandbox issue.

The sandbox boundary is the distinguishing factor.

What steps can reproduce the bug?

  1. Install Codex Desktop on Windows 11.
  2. Open an existing local development project.
  3. Select Workspace Write permissions, not Full Access.
  4. Ask Codex to execute:
cmd.exe /d /c "cd /d C:\Tools\flutter && cd"
  1. Observe:
Access is denied.
Exit code: 1
  1. Test an existing project workspace:
cmd.exe /d /c "cd /d D:\Projects\<workspace> && cd"
  1. Observe the same error.
  2. Run:
[System.IO.Directory]::SetCurrentDirectory('C:\Tools\flutter')
  1. Observe a Windows access-denied exception.
  2. Switch Codex to Full Access.
  3. Repeat the same CMD and Git tests. They succeed immediately.

The problem reproduces after a complete Codex uninstall, removal of previous generated sandbox/runtime components, and a clean reinstall.

No source-code modification is required to reproduce the issue.

Session ID and token/context-window usage were not captured. The issue is reproducible independently of model context usage.

Additional reproduction: Standalone Codex CLI

I also tested the standalone Codex CLI, launched from normal Windows PowerShell outside Codex Desktop.

The CLI reproduces the same native directory-access failure under Workspace Write sandbox permissions.

Therefore, the issue is not exclusive to the Codex Desktop application. Both Desktop and CLI exhibit the failure, while commands work outside Codex or with Full Access.

This suggests a problem in their shared Windows sandbox implementation or its interaction with the host Windows security environment.

The exact underlying security rule responsible for the denial remains unidentified.

What is the expected behavior?

Codex in Workspace Write mode should be able to execute native Windows commands and change the current working directory to an authorized project workspace or a readable external development SDK.

Basic commands such as these should work without requiring Full Access:

cmd.exe /d /c "cd /d C:\Tools\flutter && cd"

git -C C:\Tools\flutter rev-parse HEAD

flutter --version

dart --version

flutter pub get

flutter analyze

The sandbox should continue protecting unauthorized filesystem locations and restricting unsafe operations.

Users should not need to disable sandbox isolation just to run standard development tools.

A permanent fix should preserve Workspace Write security rather than require danger-full-access.

Additional information

Environment

  • Product: Codex Desktop App for Windows
  • OS: Microsoft Windows NT 10.0.26300.0 x64
  • Workspace Dependencies version: 26.1009.11318
  • Bundled Node.js and Python tools: Enabled
  • Subscription: ChatGPT Go
  • Flutter: 3.47.7 stable
  • Dart: 3.13.5
  • Git: 2.56.0.windows.2
  • Sandbox permissions: Workspace Write
  • Sandboxed process integrity: Low Mandatory Level

Background

Codex previously worked correctly with Flutter and other development tools before an SSD replacement and software environment reinstallation.

After the replacement, Flutter was installed at C:\Tools\flutter.

However, the error also occurs inside a development project on D:, so it is not exclusively related to the Flutter SDK location.

Troubleshooting already attempted

I have extensively investigated this issue.

Sandbox configuration:

  • Tested unelevated Windows sandbox.
  • Tested elevated Windows sandbox.
  • Tested the MXC sandbox option.
  • Executed the elevated sandbox provisioning procedure.
  • Expanded writable_roots to include the entire Flutter SDK.
  • Confirmed the issue persists inside an authorized project workspace.

Windows permissions:

  • Verified inherited NTFS directory ACLs.
  • Temporarily granted Read & Execute to Everyone.
  • Temporarily granted Read & Execute to CodexSandboxUsers.
  • Neither change fixed the problem.
  • Restored and verified the original NTFS permissions afterward.

The original Flutter directory ACLs include:

BUILTIN\Administrators: Full Control
NT AUTHORITY\SYSTEM: Full Control
BUILTIN\Users: Read & Execute
NT AUTHORITY\Authenticated Users: Modify

Sandbox diagnostics:

  • Confirmed the sandbox runs at Low Mandatory Integrity Level.
  • Verified PowerShell file listing and reading succeed.
  • Verified native SetCurrentDirectory fails.
  • Captured Windows CreateFile failures with Process Monitor.
  • Inspected sandbox setup logs.
  • Verified the persisted sandbox ACL-state JSON is syntactically valid.
  • Attempted Windows File System failure auditing; no matching Event 4656 was recorded.

The temporary audit rules were removed, and the original audit policy was restored.

Fresh installation:

  • Completely uninstalled Codex.
  • Removed old runtime files and generated sandbox components.
  • Reinstalled Codex.
  • Repeated the same tests with a fresh installation.
  • The exact permission failure remained.

This suggests the problem is not simply a corrupted project configuration or broken Flutter installation.

Related GitHub issues

These may be related, but the precise root cause of this reproduction has not been established.

Request to the Codex team

Could you investigate why a sandboxed native Windows process is denied Execute/Traverse, Synchronize when opening directories that should be accessible, including authorized workspaces and Codex's own bundled runtime directory?

Specifically, could this originate from:

  • Incorrect restricted-token or sandbox SID access checks?
  • Mandatory integrity policies?
  • Native subprocess initialization?
  • Windows filesystem filter enforcement?
  • A regression in Windows sandbox permission handling?

Please provide a supported fix or configuration mechanism that restores these native filesystem operations without requiring Full Access.

This issue blocks ordinary development workflows across Flutter, Dart, Git, and other native Windows tools.

Activity

  1. added
    app
    on Oct 11, 2026
  2. added
    bug
    windows-os
    sandbox
    on Oct 11, 2026
  3. RJKRanathunga commented on Oct 11, 2026

    @RJKRanathunga
    Author

    Additional diagnostic: Windows sandbox working-directory mismatch and workspace access denial

    I reproduced another failure in Workspace Write mode, without command-rule exemptions.

    The command runner was configured to use an existing local Git repository, represented below as <WORKSPACE>. The exact project path is intentionally redacted.

    Observed working directories:

    PowerShell Get-Location:
    <CODEX_RUNTIME>\dependencies\native\powershell
    
    [Environment]::CurrentDirectory:
    <WORKSPACE>
    
    USERPROFILE:
    C:\Users\<USER>
    

    Both C: and D: were registered as PowerShell filesystem drives.

    Attempts to access the workspace:

    Set-Location <WORKSPACE>
    Access is denied.
    
    Test-Path <WORKSPACE>\.git
    Access is denied.
    False
    
    git status --short
    fatal: not a git repository (or any of the parent directories): .git
    Exit code: 128
    

    Native CMD working directory:

    cmd.exe /d /c cd
    <CODEX_RUNTIME>\dependencies\native\powershell
    Exit code: 0
    

    The process-level current directory identifies the intended workspace, but PowerShell and CMD operate from Codex's runtime directory.

    The same repository works correctly in ordinary Windows PowerShell and Codex Full Access mode.

    Additional reproduction:

    • npm.cmd run build in Workspace Write searches for package.json in the Codex runtime directory instead of the requested website directory.
    • The identical build succeeds in Full Access.
    • Command-specific execution rules with decision = "allow" permit individual failing commands to succeed outside the sandbox, but do not repair general sandbox behavior.

    This appears to involve both working-directory initialization and native filesystem access restrictions.

    The exact cause remains unidentified.

    Related issue: #29688.

  4. sikarabbit commented on Oct 27, 2026

    @sikarabbit

    Additional reproduction: authorized workspace reads fail and PowerShell starts in the runtime directory

    Summary

    Codex Desktop on Windows denies directory listing and file reads inside an explicitly authorized workspace-write workspace.

    Despite the command runner specifying the workspace as workdir, PowerShell reports its location as Codex's bundled runtime directory, while [Environment]::CurrentDirectory identifies the intended workspace.

    Previously recorded execution using require_escalated successfully listed the workspace and read the same three files. Restarting Codex Desktop did not resolve ordinary sandbox access.

    Environment

    Item Details
    Product Codex Desktop for Windows
    Installed version 26.1021.31345
    Installed build 21828
    Release channel prod
    Version evidence Built-in application version/update tool; About Codex was not inspected
    Operating system Windows 11, user-reported
    Full Windows version/build Unavailable in historical records retrieved for this report
    PowerShell 7.6.5, from earlier diagnostic output
    Sandbox workspace-write
    Normal execution sandbox_permissions: "use_default"
    Approval reviewer auto_review
    Observation date October 27, 2026, Asia/Taipei

    The Windows build reported by the author of #53174 is not substituted for this machine's missing build information.

    Workspace authorization

    The execution environment explicitly included the project directory in its writable roots. The command runner also specified that directory as workdir.

    All paths below are anonymized. F:\Projects\Example Workspace preserves the original drive letter and presence of spaces without disclosing the private project name.

    sandbox_mode: workspace-write
    writable_roots includes: F:\Projects\Example Workspace
    workdir: F:\Projects\Example Workspace
    

    An additional Codex-managed visualization directory was authorized; its identifying components are omitted.

    Reproduction

    These steps describe already recorded tests; no permission tests were rerun while preparing this report.

    1. Open an existing Windows workspace in Codex Desktop.
    2. Use workspace-write with normal use_default execution.
    3. Explicitly set the command runner's workdir to the authorized workspace.
    4. Run:
    Get-ChildItem -LiteralPath 'F:\Projects\Example Workspace' -ErrorAction Stop
    
    Get-Content -LiteralPath 'F:\Projects\Example Workspace\PROJECT_STATUS.md' -Raw -Encoding UTF8 -ErrorAction Stop
    Get-Content -LiteralPath 'F:\Projects\Example Workspace\DECISION_LOG.md' -Raw -Encoding UTF8 -ErrorAction Stop
    Get-Content -LiteralPath 'F:\Projects\Example Workspace\PROJECT_HANDOFF.md' -Raw -Encoding UTF8 -ErrorAction Stop
    
    (Get-Location).Path
    [Environment]::CurrentDirectory
    1. Observe access-denied errors and inconsistent current-directory values.

    Actual results

    Directory listing and all three file reads failed:

    ExceptionType: System.UnauthorizedAccessException
    Message: Access to the path '<ANONYMIZED_PATH>' is denied.
    

    Earlier diagnostic records additionally captured:

    HResult: -2147024891
    Hex: 0x80070005
    

    PowerShell error identifiers:

    ItemExistsUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
    ItemExistsUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetContentCommand
    

    The post-restart diagnostic recorded:

    Get-Location:
    C:\Users\<USER>\.cache\codex-runtimes\codex-primary-runtime\dependencies\native\powershell
    
    [Environment]::CurrentDirectory:
    F:\Projects\Example Workspace
    
    Equal:
    False
    

    The diagnostic wrapper caught individual errors and continued, so its overall exit code was 0. That exit code does not indicate successful filesystem access.

    Historical require_escalated comparison

    A prior diagnostic conversation contains a completed command execution and its output, together with the accompanying report explicitly identifying it as require_escalated execution.

    Relevant commands from that recorded execution are reproduced below with paths anonymized; unrelated process/account and ACL inspection is omitted:

    Get-Location
    
    Get-ChildItem -LiteralPath 'F:\Projects\Example Workspace' -Force -ErrorAction Stop |
        Select-Object Name, Mode |
        ConvertTo-Json
    
    # Executed for each of the three document paths:
    Get-Content -LiteralPath $diagTarget -TotalCount 1 -ErrorAction Stop

    Recorded results:

    Operation Normal sandbox Historical require_escalated execution
    List workspace root Access denied Successful
    Read PROJECT_STATUS.md Access denied First line returned
    Read DECISION_LOG.md Access denied First line returned
    Read PROJECT_HANDOFF.md Access denied First line returned
    Get-Location Bundled runtime directory Intended workspace

    The successful command completed with exit code 0. Private directory names and document-heading contents are omitted.

    Evidence limitation: The historical conversation viewer exposes the executed command, output and accompanying execution-mode description, but does not expose the original structured sandbox_permissions argument in the command summary. This was a per-command escalation comparison, not a documented switch of the entire application to Full Access.

    Persistence after restart

    The user reported restarting Codex Desktop before the October 27 diagnostic. The subsequent normal sandbox execution still failed to list the workspace or read the three files and still showed the directory mismatch.

    No Windows restart or clean reinstall was verified in this case.

    Expected behavior

    Normal workspace-write execution should permit directory listing and file reads within its explicitly authorized workspace.

    PowerShell should initialize to the command runner's requested working directory, or report a clear initialization failure. Absolute-path reads should not require escalation for an authorized workspace.

    Relationship to #53174

    The existing issue and its follow-up diagnostic describe authorized-workspace access failures and the same runtime-directory versus process-directory mismatch.

    Relevant differences:

    • This case also fails PowerShell directory listing and file reads; the original issue's initial examples included successful PowerShell reads.
    • This case uses an F: workspace and a newer installed Desktop version.
    • This case has a historical per-command escalation comparison; the existing issue documents Full Access comparisons.
    • No CLI reproduction, Process Monitor capture or confirmed underlying Windows security mechanism is available for this case.

    The overlap supports adding evidence to #53174 first, but does not establish an identical root cause.

    Scope and privacy

    This report was prepared from existing diagnostic records, application version metadata and the public issue. No new permission tests, installations, system-setting changes or project-file modifications were performed.

    Usernames, machine names, private project paths, media names and session identifiers have been removed. No private document contents are attached.

  5. denelon commented on Nov 5, 2026

    @denelon

    A Microsoft MXC issue may provide useful diagnostic context for the native working-directory and path-resolution failures reported here:

    Both reports describe native tools failing to establish or resolve working directories inside a Windows sandbox even though some PowerShell filesystem reads succeed, with Git among the affected tools. The lower-level evidence differs: this Codex report observes CreateFile directory opens being denied, while the MXC issue reports successful handle creation followed by failure during DOS-path translation. The issues may therefore involve adjacent path-handling behavior, but the correlation does not establish a shared root cause.

    Drafted with GitHub Copilot assistance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appbugsandboxwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions