Skip to content

execpolicy check does not mirror runtime PowerShell wrapper unwrapping #24201

Open

Description

@Alien-AV

codex execpolicy check appears not to use the same PowerShell-wrapper normalization as the runtime approval path on Windows.

Observed behavior:

  • Runtime approval is expected to unwrap top-level PowerShell commands such as pwsh.exe -Command "gh issue view ..." and evaluate rules against the inner command, following the behavior added in PR execpolicy: unwrap PowerShell -Command wrappers on Windows #20336.
  • codex execpolicy check, however, appears to match the raw command tokens directly.
  • A rule such as prefix_rule(pattern=["gh", "issue"], decision="allow") reports allow for direct gh issue ....
  • The same rule does not match when checking a wrapped command shaped like C:\Program Files\PowerShell\7\pwsh.exe -Command "gh issue view ...".
  • This makes execpolicy check unreliable as a way to validate whether a user rule will suppress runtime approval prompts on Windows.

The source seems to explain the difference: runtime approval goes through core/src/exec_policy.rs and commands_for_exec_policy(), while execpolicy check appears to call policy matching directly over the provided command tokens.

Expected: codex execpolicy check should either use the same command normalization path as runtime approval, or the docs/help should clearly say it only validates raw policy matching and does not model runtime shell-wrapper normalization.

Activity

  1. added
    bug
    CLI
    windows-os
    sandbox
    on May 23, 2026
  2. github-actions commented on May 23, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. Alien-AV commented on May 23, 2026

    @Alien-AV
    Author

    Not a duplicate of #24198, separate issue.

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

    CLIbugsandboxwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions