Repository navigation
Description
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:
- https://github.com/openai/codex/blob/rust-v0.162.0-alpha.2/codex-rs/shell-command/src/command_safety/windows_dangerous_commands.rs#L38
- https://github.com/openai/codex/blob/rust-v0.162.0-alpha.2/codex-rs/core/src/exec_policy.rs#L799
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
github-actions commentedon Oct 16, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
CreateProcess: blocked by policy#53977Powered by Codex Action
yunxibaili commentedon Oct 21, 2026
Follow-up based only on published source: the same predicate is present in commit
4ebc485ca321243727539187169425fcf972f2c4.windows_dangerous_commands.rs, lines 57–63 combines
has_urlwith a token containingshellexecute, without distinguishing the defensive assignmentUseShellExecute=falsefrom an actual ShellExecute invocation.exec_policy.rs, lines 793–806 maps a dangerous match under
NevertoForbidden; lines 1110–1118 render theOtherreason asblocked 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.
lauman999 commentedon Nov 27, 2026
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/'andWrite-Output 'UseShellExecute'each exited 0.Write-Output 'https://example.invalid/' 'UseShellExecute'was rejected before PowerShell started withCreateProcess … 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 inwindows_dangerous_commands.rs; no per-call verdict trace was available. Please distinguish inert data from URL launches while maintaining existing protections.