From 0c61c48eece509b169da647abab38608415bfd3f Mon Sep 17 00:00:00 2001 From: iceweasel-oai Date: Wed, 29 Apr 2026 21:23:56 -0700 Subject: [PATCH] only use inner powershell command for rule matching --- codex-rs/core/src/exec_policy.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/codex-rs/core/src/exec_policy.rs b/codex-rs/core/src/exec_policy.rs index 6215a8231b..094fddcc5e 100644 --- a/codex-rs/core/src/exec_policy.rs +++ b/codex-rs/core/src/exec_policy.rs @@ -886,7 +886,14 @@ fn derive_requested_execpolicy_amendment_from_prefix_rule_for_powershell( return None; } - if matched_rules.iter().any(is_policy_match) { + // PowerShell evaluation can combine outer wrapper matches with unmatched + // inner commands. Existing explicit allow rules should not suppress a + // requested inner-command prefix rule that would resolve the remaining + // prompt, but explicit prompt/forbidden matches still should. + if matched_rules + .iter() + .any(|rule_match| is_policy_match(rule_match) && rule_match.decision() != Decision::Allow) + { return None; }