Skip to content

Windows: benign PowerShell here-string with START in a path rejected before execution #50724

Open

Description

@LobsterKingAbsolute

Environment

  • Windows 11, Codex desktop.
  • The running app's update tool reports version 26.930.31730, build 12947,
    production channel, status up_to_date.
  • The affected task reports approval_policy=never, full filesystem access.
  • A separately inspected Windows package registration reports 26.930.3930.0;
    this is not asserted to identify the running backend or its source revision.

Minimal reproduction

The following command was submitted once through exec_command:

@'
const source = 'D:/Demo START folder/input';
const remote = 'https://example.invalid/repository.git';
'@ | & 'Write-Output'

It should only print a literal string. It does not execute JavaScript, invoke
Git, access a file, launch a browser or perform a network request.

Actual result: rejection before process creation, with the generic message
CreateProcess ... Rejected ... blocked by policy. No approval item or
specific rule identifier was returned. This is an observed benign reproduction.

Source-supported hypothesis, not an internal decision trace

At commit 1f4c47343a1bff2d8cddc429c5d39503fb5a6c30, the Windows classifier
uses POSIX shlex on PowerShell script text. Nested quotes in a PowerShell
here-string can expose the path word START as a separate token. A URL plus
that token matches its URL-launch heuristic, even though the only invoked
command in this reproduction is Write-Output.

Please confirm the rejecting predicate and provide a supported correction or
action-specific resolution. The regression should distinguish string data
from actual URL-launch commands while preserving checks on real launches.
The generic error alone does not prove which predicate was used by the
installed backend. No policy or permission settings were changed.

Activity

  1. added
    bug
    app
    windows-os
    sandbox
    tool-calls
    on Oct 3, 2026
  2. agbullen commented on Oct 22, 2026

    @agbullen

    Confirmed minimal reproduction and comparison results — 22 October 2026

    Adding an independently observed reproduction of this same false positive. It also occurs when start is an ordinary word in a documentation sentence, rather than part of a path.

    Environment

    • Codex desktop on Windows x64, OS version 10.0.26200.0.
    • Running desktop backend executable reports codex-cli 0.163.0-alpha.11.
    • Windows app package version: 26.1016.6573.0 (package version, not asserted to identify the backend source commit).
    • PowerShell Core 7.6.5; Node.js v24.14.1.
    • Affected session: approval_policy = never, approvals_reviewer = user, sandbox_policy = danger-full-access.
    • These were the existing session settings. No approval, sandbox or policy settings were changed for the investigation or local text-edit correction.

    Steps to reproduce

    1. In Codex on Windows with the above effective settings and Node available, have the agent submit the following as one exec_command PowerShell command. Running it directly in an ordinary terminal does not exercise Codex's command policy.
    2. Keep the single-quoted PowerShell here-string and nested JavaScript single quotes as shown:
    @'
    const note = 'It did not start a new runtime.';
    const address = 'https://example.invalid';
    console.log('diagnostic only');
    '@ | node --input-type=module

    This script only defines two strings and prints a fixed message. It performs no filesystem writes, network requests, browser launch or service startup.

    Expected: Node runs, prints diagnostic only, and exits successfully.

    Observed: Codex rejects the command before execution with blocked by policy; Node does not run. The error gives no matched rule or actionable reason.

    Observed comparisons

    Submitted content Actual outcome
    Original quoted sentence containing start, plus the URL literal Rejected before execution
    Same diagnostic with the word start absent from the sentence Executed successfully
    Same diagnostic with the URL absent Executed successfully
    Native direct file creation and update containing the original sentence and URL Saved and read back successfully, preserving the text

    The first three are diagnostic controls, not suggested text-obfuscation workarounds. This also blocked a real local documentation/JSON-reference update and later an inline verification script whose expected text contained the same combination. Private project material is unnecessary to reproduce it and is omitted.

    Source-supported likely cause

    At inspected public commit c2d5ea52e1b7ab11ee2d71dc44ea1ef00f9c8eb3, classify_powershell_words computes URL presence across the token list. In the Opaque case it accepts start at any token index as a URL-launch marker:

    windows_dangerous_commands.rs, lines 105–123

    The PowerShell parsing/fallback selection in exec_policy.rs is also relevant. Flattening nested quoted here-string contents can expose an ordinary prose word as though it were a command token.

    The harmless reproduction and comparison outcomes are observed facts. The specific internal rejecting predicate is a source-supported diagnosis: no internal decision trace was returned, and the inspected public commit is not asserted to be the exact source revision of the running backend. The recorded reviewer was user; we found no evidence that this rejection came from automatic approval review.

    Requested fix and regression coverage

    • Distinguish executable PowerShell command/argument positions from literal here-string and nested-language data. Associate a URL with its actual launch command rather than any matching word elsewhere in the script.
    • Add regression coverage for this exact harmless here-string, the two comparison cases, and ordinary local Markdown/JSON writes containing this text.
    • Preserve restrictions on real URL-launch commands; no broad allow rule or disabled safeguard is requested.
    • Include the rejecting policy component/rule or a useful reason in the error so a false positive can be diagnosed without guessing.

    Related: #55165 reports a similar source-writing failure without a minimal reproduction; #40060 describes the broader unrelated-URL association problem.

    No credentials, private paths, account details, full transcripts or project files are included in this report.

  3. dowttrev commented on Oct 27, 2026

    @dowttrev

    Additional occurrence on Windows desktop, 2026-10-27, with installed command runner codex-cli 0.164.0-alpha.11.1.

    A PowerShell here-string piped into Node to create and run isolated node:test fixtures was rejected before process creation with CreateProcess ... Rejected ... blocked by policy. The text contained a test description non-TAP preserves start and end and an unrelated mock endpoint http://127.0.0.1:1/v1. There was no actual Start-Process/browser-launch operation in the rejected command.

    Read-only diagnostics:

    • Effective session logs show approval_policy=Never sandbox_policy=DangerFullAccess.
    • codex execpolicy check of the exact rejected command against the user's local default.rules returned {"matchedRules":[]}. This does not rule out other enforcement layers.
    • Python shlex tokenization of the saved command exposed start as a standalone token inside that test description, with a URL-bearing token elsewhere. This is an approximation, not an exact Rust classifier reproduction.
    • Current default-branch Windows command-checker source provides the matching hypothesis: pipeline/opaque handling plus URL and start token. The source revision was not matched to the installed binary; the runtime did not disclose the actual matched predicate.

    Please confirm the rejecting predicate, add a regression for ordinary prose inside PowerShell here-strings, and provide an actionable rule identifier or supported per-action approval path. Preserve checks on real URL-launch commands. No protections were disabled or alternate execution route used. Private project source, filesystem paths, session transcript, and credentials are intentionally omitted.

  4. ArrebolBlack commented on Oct 30, 2026

    @ArrebolBlack

    Adding a confirmed Python reproduction and a failing Rust regression from an affected Windows desktop session.

    Observed reproduction

    Submit this as one PowerShell exec_command in a Full access chat:

    @'
    print('Existing start intent must be reconciled')
    print('https://example.invalid/path')
    '@ | python -

    Expected: print two string literals. There are no network calls, file mutations, browser launches, or compute operations.

    Observed: rejected before process creation with CreateProcess Rejected: blocked by policy. Removing /path from the URL literal allowed the two lines to print in an observed control. These are diagnostic comparisons, not proposed execution workarounds.

    The running desktop updater reports version 26.1027.30824, build 22943, production channel, up_to_date. The reproduction chat metadata records CLI 0.165.0-alpha.1.2; this is not asserted to identify the exact currently serving backend revision. The rejected turn records approval_policy=never and sandbox_policy=danger-full-access; the saved reviewer is user.

    Source reproduction

    I compiled the actual public upstream windows_dangerous_commands.rs and powershell_tree_sitter.rs modules in an isolated Cargo harness. Their 42 existing unit tests pass. This added regression fails on unchanged production logic:

    #[test]
    fn powershell_here_string_python_literals_are_not_url_launches() {
        let script = "@'\nprint('Existing start intent must be reconciled')\nprint('https://example.invalid/path')\n'@ | python -";
        assert!(!is_dangerous_command_windows(&vec_str(&[
            "pwsh", "-Command", script,
        ])));
    }

    The full workspace suite was not completed: workspace Git dependency resolution encountered network timeouts. The harness imports the actual source files; it is not a reimplementation of the classifier.

    The source reproduces the suspected path: unsupported here-string/native-stdin pipeline → POSIX shlex_split on PowerShell source → standalone start from the Python diagnostic string plus an unrelated URL → opaque URL-launch match. In exec_policy.rs, a dangerous match under AskForApproval::Never becomes Forbidden, and the Other reason is rendered as blocked by policy. The generic runtime error does not expose its exact matched predicate.

    Related PR #54076 fixes independent literal commands but intentionally retains conservative pipeline handling.

    Requested correction

    Please fix the literal-data classification while retaining executable pipeline input, actual URL-launch checks, force-delete checks, expandable expressions, and shell/alias state handling. Simply coalescing or discarding every here-string is insufficient for interpreter input. Please also expose the matching heuristic and disabled-prompt reason in rejection diagnostics, and cover both configured-shell identity routes in exec-policy regression tests.

    The documented interim configuration approval_policy="on-request" with approvals_reviewer="user" was prepared and selected through Custom (config.toml). Saved chat state reflected the change, while the already-running turn retained never and still rejected its inert retest.

    Fresh-turn verification on 2026-10-30 now confirms the supported manual-approval path: the new turn records approval_policy=on-request, the session log records an ExecApproval decision of approved, and the identical reproduction exits 0 with both original lines printed. No broad allow rule or custom classifier binary was added. This resolves the unapprovable execution path for this reproduction; the parser false positive itself remains unresolved.

    No custom classifier binary, broad allow rule, private project material, credentials, service addresses, chat identifiers, or raw logs are included.

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

    appbugsandboxtool-callswindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions