Skip to content

Windows PowerShell safety heuristic flags UseShellExecute=false with unrelated loopback URL text (0.162.0-alpha.2) #54463

Open

Description

@HViewLeon

Windows PowerShell safety heuristic flags UseShellExecute=false when unrelated loopback URL text is present

Codex CLI: 0.162.0-alpha.2 on Windows. Approval policy: never. Filesystem access: unrestricted. No local .rules files were found in the inspected user/project layers.

The Windows command classifier in tag rust-v0.162.0-alpha.2 flattens PowerShell script text using shlex. In is_dangerous_powershell_words, an HTTP/HTTPS URL anywhere in the token list combined with any token containing the substring shellexecute produces a dangerous match. This also matches the defensive assignment .UseShellExecute = $false, without requiring a ShellExecute call or process launch.

This is an inert, invented text example for static inspection; do not execute it to collect credentials or operate any device:

$p = New-Object System.Diagnostics.ProcessStartInfo
$p.UseShellExecute = $false
$u = 'http://127.0.0.1:9/'
'inert text only'

The source branch at lines38–64 is sufficient to flag this text. The exec-policy fallback maps the dangerous match to Forbidden when approvals are never, then renders DangerousCommandMatch::Other as blocked by policy.

Observed wrapper output in a real authorized local development workflow:

exec_command failed: CreateProcess { message: "Rejected(\"`<REDACTED_COMMAND>` rejected: blocked by policy\")" }

A separate attempted local diagnostic that only placed invented examples inside Python string literals was also rejected before process creation. Its diagnostic comparisons did not execute. The original command was not replayed, and no safety policy was disabled or overridden. Static PowerShell ParseInput on the original command reported zero top-level syntax errors. Those facts do not establish end-to-end authorization for that original action.

Please fix the classifier to distinguish setting UseShellExecute to false and inert data from actual URL-bearing ShellExecute operations, while retaining checks for real ShellExecute/Start-Process/browser launches and dangerous deletion. Suggested regression coverage: false assignment plus unrelated loopback URL; the same source text inside an inert Python string; actual ShellExecute URL invocation; Start-Process URL; forced deletion. An upgrade should only be recommended after the false-positive case and true-positive controls are verified.

Public source references:

This report deliberately excludes project source, original command, session IDs, accounts, devices, credentials and private logs. It does not request a broad allowlist or a review bypass.

Related existing report: #47213. This report adds version-matched 0.162.0-alpha.2 source inspection and a refusal of a diagnostic containing only inert Python string examples; no candidate binary or policy modification was deployed.

Activity

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

    @github-actions
    Contributor

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

    Powered by Codex Action

  3. yunxibaili commented on Oct 21, 2026

    @yunxibaili

    Follow-up based only on published source: the same predicate is present in commit 4ebc485ca321243727539187169425fcf972f2c4.

    windows_dangerous_commands.rs, lines 57–63 combines has_url with a token containing shellexecute, without distinguishing the defensive assignment UseShellExecute=false from an actual ShellExecute invocation.

    exec_policy.rs, lines 793–806 maps a dangerous match under Never to Forbidden; lines 1110–1118 render the Other reason as blocked by policy.

    Could a maintainer confirm whether this is an unintended false positive and identify a verified fixed version or a supported, privacy-safe way to obtain the actual matched-rule trace?

    This is static source analysis, not confirmed attribution of a particular runtime rejection. No denied action was rerun for this follow-up. Please preserve protection for actual URL-bearing process launches; no policy bypass or broad relaxation is requested.

  4. lauman999 commented on Nov 27, 2026

    @lauman999

    Additional confirmation on Windows Codex desktop (bundled CLI 0.171.0-alpha.13.2): using the same native execution tool, Write-Output 'https://example.invalid/' and Write-Output 'UseShellExecute' each exited 0. Write-Output 'https://example.invalid/' 'UseShellExecute' was rejected before PowerShell started with CreateProcess … rejected: blocked by policy. The commands only print literals; they do not fetch a URL or launch a program. This is consistent with the same-version substring check in windows_dangerous_commands.rs; no per-call verdict trace was available. Please distinguish inert data from URL launches while maintaining existing protections.

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