Skip to content

Windows exec_command: opaque pre-launch policy rejection during bounded SDK acquisition; supported diagnostics and execution contract #56685

Open

Description

@KrondeJeff

Environment and evidence limits

  • Windows, local Codex desktop workflow, PowerShell execution through exec_command.
  • Historical CLI version recorded at the original failure: 0.162.0-alpha.2.
  • Original failure time: 2026-10-23T14:46:28.189Z.
  • The current desktop/CLI version has not been independently collected for this report. The historical version above is not asserted to be the current version.

Observed result

An explicitly user-authorized, bounded .NET SDK material-resumption and ZIP-metadata-indexing operation was rejected with:

exec_command CreateProcess rejected: blocked by policy

The returned evidence did not identify the enforcing component or matched rule, and did not provide a native session ID, exit code, or terminal receipt. It does not establish that the requested PowerShell operation ran.

A separate, earlier read-only PowerShell version query was allowed. This is not evidence that the rejected operation is now allowed, nor that all execution is broken.

The rejected operation has not been retried or moved to another executor/encoding/mirror. No security settings were changed to bypass it. No independent minimal reproduction was performed.

Static upstream lead (not reproduced)

The historical version tag rust-v0.162.0-alpha.2 resolves to commit 74e804deeb1241d5fe699b31fb319f7d46454c42.

A source-only inspection found a plausible overbroad Windows classification branch:

  • The Windows PowerShell heuristic combines URL detection with a substring match for shellexecute / shell.application; it does not distinguish a ShellExecute invocation from a similarly named process-configuration property or its Boolean value:
    pub(crate) fn is_dangerous_powershell_words(words: &[String]) -> bool {
    let tokens_lc: Vec<String> = words
    .iter()
    .map(|t| t.trim_matches('\'').trim_matches('"').to_ascii_lowercase())
    .collect();
    let has_url = args_have_url(words);
    if has_url
    && tokens_lc.iter().any(|t| {
    matches!(
    t.as_str(),
    "start-process" | "start" | "saps" | "invoke-item" | "ii"
    ) || t.contains("start-process")
    || t.contains("invoke-item")
    })
    {
    return true;
    }
    if has_url
    && tokens_lc
    .iter()
    .any(|t| t.contains("shellexecute") || t.contains("shell.application"))
    {
    return true;
    }
  • The fallback maps a dangerous match plus AskForApproval::Never to Decision::Forbidden:
    // If the command is flagged as dangerous or we have no sandbox protection,
    // we should never allow it to run without approval.
    //
    // We prefer to prompt the user rather than outright forbid the command,
    // but if the user has explicitly disabled prompts, we must
    // forbid the command.
    if dangerous_command_match.is_some() || windows_managed_fs_restrictions_without_sandbox_backend
    {
    return match approval_policy {
    AskForApproval::Never => Decision::Forbidden,
    AskForApproval::OnRequest
    | AskForApproval::UnlessTrusted
    | AskForApproval::Granular(_) => Decision::Prompt,
    };
  • The generic Other classification is rendered as blocked by policy:
    fn dangerous_command_rejection_reason(
    dangerous_command_match: DangerousCommandMatch,
    ) -> &'static str {
    match dangerous_command_match {
    DangerousCommandMatch::ForcedRm => {
    "rm -f style commands are not permitted. Use a safer approach"
    }
    DangerousCommandMatch::Other => "blocked by policy",
    }

This is a static hypothesis only. The incident's actual native argv, parsed tokens, effective rule evaluation and enforcing layer have not been recovered. The classifier and rejected command have not been run. Please confirm or rule out this branch using a supported diagnosis; no command-spelling change, property removal or executor substitution is proposed as a bypass.

Supported diagnosis requested

  1. Which component/rule can produce this exact rejection, and what supported review/diagnosis route can disclose its source and reason?
  2. The current chat surface has no feedback menu when the user enters /. What supported private diagnostic channel should be used if additional incident details are necessary? The absence of that menu is not diagnosed as a configuration bug.

Execution-contract clarification requested

For the currently supported Windows client/executor, please identify the documented interface and its actual limits for these four project-level evidence needs:

  • Initial environment: effective environment allowlisting and login/profile control before the requested native command starts, including configuration precedence. The exposed tool request does not itself provide a per-call initial-environment dictionary; that is not a claim that Codex has no environment-control configuration.
  • Timing and stopping: when a deadline begins; which processes/descendants timeout, terminate, and session-disconnect handling cover; how failed or unknown stopping is reported. A yield interval/session return is not itself a whole-tree completion receipt. We are not requesting an impossible guarantee of preempting arbitrary kernel operations.
  • Raw output custody: per-stream raw stdout/stderr byte order and identity, EOF/completion, truncation/loss indicators, and a supported way to retain that evidence rather than only a token-limited formatted excerpt.
  • Launch ownership: the actual executable/argv and any shell/shim layers, and how this invocation's process/session ownership and observed terminal status can be correlated without relying on historical PIDs.

Official documentation describes command/exec, timeoutMs, streaming base64 output, termination, and shell_environment_policy. Those documented facilities are not assumed to be exposed in this chat or to establish stronger Windows process/output guarantees than their documented contracts.

References:

These project requirements are not asserted to be existing product guarantees. An explicit unsupported/limited answer with a supported client/interface path is useful. The request is for an actionable supported route, not a workaround that disables protections.

Privacy

The user explicitly approved this sanitized public report. No thread/session ID, local path, project source, trading/account data, environment-variable value, private log, credential, or full conversation is attached.

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