Skip to content

Windows elevated sandbox: WinError 5 when creating directory inside workspace-write root #52339

Open

Description

@Jackchen1005

Summary

In the Codex Windows Desktop App, the native Windows elevated sandbox is configured with workspace-write permissions, but Python fails to create a new directory inside an authorized workspace.

The issue reproduces using only Python's standard library, without loading the application pipeline, MinerU, or OCR components.

The failure prevents a PDF-to-EPUB conversion project from creating its working directories.

Environment

  • Product: Codex Windows Desktop App
  • Codex Core: 0.160.0 (verified)
  • Desktop App version: 26.1007.11041 (previously observed; current version not reconfirmed)
  • Operating system: Windows 10 Pro, version 22H2
  • OS Build: 19045.6466
  • Windows Sandbox mode: elevated
  • Sandbox permissions: workspace-write
  • Execution identity: codexsandboxoffline, medium integrity
  • Python version: 3.10.11
  • Workspace: D:\@codex Projects\PDFtoEPUB
  • Working directory: D:\@codex Projects\PDFtoEPUB\app\Books_Converter-Local-A770

Steps to Reproduce

  1. Use Codex Windows Desktop App with Windows Sandbox set to elevated.
  2. Configure permissions as workspace-write.
  3. Ensure the PDFtoEPUB workspace is included in the effective writable roots.
  4. Use Python 3.10.11 with the working directory shown above.
  5. Run the following minimal Python script using the same Python executable and execution mechanism as the affected pipeline:
from pathlib import Path
from uuid import uuid4

parent = Path(
    r"D:\@codex Projects\PDFtoEPUB\output Epub\_audit\work"
).resolve()

target = parent / (
    "civil_law_w4_selective_p001_p010_p040-"
    "c1f3b030cb40e925-fresh-" + uuid4().hex
)

parent.mkdir(parents=True, exist_ok=True)
target.mkdir(exist_ok=False)

The parent directory already exists. The failure occurs when attempting to create the new child directory.

The original reproduction used Python 3.10.11 with process-local offline model environment settings.

Actual Behavior

The operation target.mkdir(exist_ok=False) fails with:

PermissionError: [WinError 5] Access is denied

errno = 13
winerror = 5

The captured traceback ends at:

Python310\Lib\pathlib.py, line 1175
self._accessor.mkdir(self, mode)

The failure was reproduced on October 8, 2026, at approximately 16:48 UTC.

The target directory was not created. No OCR or PDF conversion was started.

Expected Behavior

When the workspace is explicitly included in the effective writable roots and the sandbox is configured with workspace-write permissions, creating a new directory inside the authorized workspace should succeed unless another documented restriction applies.

Elevated vs. Unelevated Sandbox

  • Elevated: FAIL — WinError 5 confirmed.
  • Unelevated: NOT TESTED.

The elevated sandbox has been preserved to avoid weakening existing security isolation.

Diagnostic Findings

The following investigations have already been completed:

  1. Confirmed that the effective writable roots include the PDFtoEPUB workspace.
  2. Confirmed that the Windows elevated sandbox initialization completed with errors=[].
  3. Confirmed that the parent directory is an ordinary directory, not a symbolic link or reparse point.
  4. Inspected NTFS permissions. Inherited Modify permissions exist for the sandbox group; no explicit Deny entry was identified.
  5. Checked Microsoft Defender Operational events. No corresponding denial event was found.
  6. Windows Security access-denial telemetry could not be fully inspected.
  7. A separate short-name UUID directory creation test succeeded from the workspace root, although its exact Python executable and security token were not independently captured.
  8. Reproduced WinError 5 with the pipeline's Python executable and working directory, without importing any application code or starting MinerU.

The existing-parent mkdir(parents=True, exist_ok=True) call succeeded, but this only confirmed the existing directory and does not establish that a new directory could be created.

The root cause remains undetermined.

Logs

Existing Windows Sandbox diagnostic logs are available upon request but are not attached to this public report.

No files from .sandbox-secrets are included.

Requested Assistance

Could the Codex team investigate:

  1. Whether effective writable-root enforcement differs between individual Codex command invocations.
  2. Whether process security tokens or working-directory-specific sandbox policies could explain the difference between successful and failed directory creation.
  3. Whether Windows Sandbox or filesystem-filter telemetry identifies the actual access denial.
  4. Whether there is an officially supported repair procedure for the elevated sandbox that preserves existing isolation.

I would prefer to resolve this issue without disabling the sandbox, enabling unrestricted filesystem access, or manually weakening Windows security policies.

Thank you for your assistance.

Activity

  1. added
    bug
    app
    windows-os
    sandbox
    on Oct 9, 2026
  2. github-actions commented on Oct 9, 2026

    @github-actions
    Contributor
  3. jobimtg commented on Nov 23, 2026

    @jobimtg

    Additional Windows workspace-write directory-creation failure (root cause unconfirmed)

    I have a similar symptom, but have not established that it shares this issue's root cause.

    Recorded failure

    • Python standard-library os.mkdir failed with PermissionError: [WinError 5] Access is denied for a new child directory inside the declared writable root.
    • Paths are redacted as <PROFILE_WORKSPACE>\<NEW_STAGING_DIRECTORY>.
    • No directory or source file was created; no bytes were written.

    Environment and evidence limits

    • Current Windows runtime-reported version: 10.0.26300.0; edition and complete servicing revision are unverified.
    • Current installed Codex App package: 26.1111.9664.0. The failure-time App/Core version and actual Windows sandbox backend are unverified.
    • Declared permission mode: workspace-write.
    • A currently resolved Python executable has file version 3.13.15; the failure-time interpreter identity was not captured.

    Existing read-only findings

    • The inspected profile account was at Medium integrity. Parent DACL included FullControl for that account, which does not establish effective sandbox authorization.
    • Ancestor inspection found no reparse points.
    • A bounded Defender Operational query returned no matching candidates for IDs 1121, 1122, 1123, 1124, 1127 and 1128 during 2026-11-23T00:30:00Z–01:05:00Z. This does not exclude a security-layer denial.
    • Exact failure timestamp/PID and an operation-linked Codex policy denial reason were unavailable.

    No new reproduction, security-setting changes or sandbox bypasses were attempted while preparing this comment.

    Could maintainers provide a supported, non-destructive way to identify the active Core/backend and the exact denying layer, and an applicable official repair/version if known? Any remedy must preserve workspace-write isolation without Full Access, elevation, ACL changes or disabling Windows protection.

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