Skip to content

Windows sandbox: per-workspace capability SIDs may not isolate workspaces due to Everyone restricting SID #17551

Open

Description

@magreenblatt

Note: This is based on code analysis of the Windows sandbox implementation, not empirical testing. The behavior described below may be incorrect if there are runtime mechanisms not visible in the source.

Summary

The Windows sandbox uses per-workspace capability SIDs (cap.rs, workspace_by_cwd) intended to isolate concurrent workspace sessions from each other's writes. However, the restricted token also includes the world SID (Everyone, S-1-1-0) as a restricting SID, and writable paths receive Everyone ACEs to satisfy the WRITE_RESTRICTED check.

If this analysis is correct, any sandbox session — regardless of which workspace capability SID it carries — can write to any workspace directory that has an Everyone ACE, because the WRITE_RESTRICTED kernel check passes via the world SID.

Expected behavior

Session A (with workspace A's capability SID) should not be able to write to workspace B's directory, even if both sessions run concurrently.

Possible behavior (based on code reading)

Session A can write to workspace B because the Everyone ACE on B satisfies the WRITE_RESTRICTED check through the world SID restricting SID, bypassing the per-workspace capability SID isolation.

Suggested fix

Replace the world SID (Everyone) restricting SID with the sandbox user's own SID. The sandbox user already has explicit allow ACEs on writable paths (set by the elevated setup helper), so those ACEs would satisfy both the normal DACL check and the WRITE_RESTRICTED check. Per-workspace capability SIDs would then provide real isolation — only the session whose token includes workspace A's capability SID could write to workspace A.

This also tightens the general write restriction: with the world SID, any object with an Everyone ACE (common on shared directories) is writable during the session. With the sandbox user's SID, only objects with explicit sandbox user ACEs are writable.

Activity

  1. added
    bugSomething isn't working
    CLIIssues related to the Codex CLI
    windows-osIssues related to Codex on Windows systems
    sandboxIssues related to permissions or sandboxing
    on Apr 12, 2026
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

    bugSomething 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