fix(exec): fail closed on Windows shell wrappers in allowlist mode#67655
Conversation
Greptile SummaryThis PR closes an allowlist-bypass for Windows shell wrappers other than
Confidence Score: 4/5Not safe to merge as-is — a stale test assertion will fail in CI. The security fix itself is correct and the new PowerShell regression test is well written, but the existing formatSystemRunAllowlistMissMessage test was left with a substring that no longer appears in the updated message, which will cause a test failure. That P1 must be fixed before landing. src/node-host/exec-policy.test.ts lines 67–74 — stale .toContain() assertion needs to match the new message text.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d523e57e62
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return ( | ||
| "SYSTEM_RUN_DENIED: allowlist miss " + | ||
| "(Windows shell wrappers like cmd.exe /c require approval; " + | ||
| "(Windows shell wrappers like cmd.exe /c or powershell -Command require approval; " + |
There was a problem hiding this comment.
Preserve message compatibility with existing allowlist tests
The updated denial text in formatSystemRunAllowlistMissMessage inserts or powershell -Command between cmd.exe /c and require approval, which no longer matches the existing assertions that still expect the old contiguous phrase (src/node-host/exec-policy.test.ts:67-74 and src/node-host/invoke-system-run.test.ts:25-31). This commit therefore introduces deterministic test regressions unless the dependent checks are updated in the same change or the message keeps a backward-compatible substring.
Useful? React with 👍 / 👎.
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: the merged payload-evaluation fix in #80978 covers the useful Windows shell-wrapper allowlist hardening on current main, while this branch's remaining blanket PowerShell fail-closed behavior would add compatibility risk. Canonical path: Keep the merged payload-evaluation policy from #80978; open a narrow docs follow-up only if node docs need to describe the current PowerShell payload-evaluation behavior more precisely. So I’m closing this here and keeping the remaining discussion on #80978. Review detailsBest possible solution: Keep the merged payload-evaluation policy from #80978; open a narrow docs follow-up only if node docs need to describe the current PowerShell payload-evaluation behavior more precisely. Do we have a high-confidence way to reproduce the issue? Yes for source-level review: current main tests and allowlist code show the original bare PowerShell wrapper allowlist gap is covered by payload evaluation. I did not run a live Windows node exec scenario in this read-only review. Is this the best way to solve the issue? No. The merged payload-evaluation approach in #80978 is the better fix because it rejects bare wrapper matches without blanket-denying allowlisted inner payloads. Security review: Security review cleared: No concrete supply-chain regression was found; the security concern here is merge compatibility with the already-merged exec approval policy, not new dependencies or secret handling. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 4644e0c10256. |
d523e57 to
3baf42a
Compare
|
Maintainer update: rebased this onto current main and prepared the branch at What changed in the prepared head:
Verification run locally:
Waiting on fresh CI/ClawSweeper for this prepared head before merge. |
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
This pull request has been automatically marked as stale due to inactivity. |
|
ClawSweeper applied the proposed close for this PR.
|
Issue
In Windows allowlist mode, the wrapper guard only failed closed for
cmd.exe-style invocations. That left a gap where other shell-wrapper transports such aspowershell -Commandcould still be analyzed like a normal allowlisted command, which is the wrong security posture for inline shell payloads and command chaining.Fix
shellWrapperInvocationis true, instead of limiting the guard tocmdInvocationpowershell -Commandalongsidecmd.exe /csrc/node-host/exec-policy.test.tsHow to test
pnpm test src/node-host/exec-policy.test.ts src/node-host/invoke-system-run.test.ts -t "PowerShell|shell wrapper|cmd.exe wrappers|allowlist"isWindows: true,shellWrapperInvocation: true, andcmdInvocation: falsewindowsShellWrapperBlockedis set, and the error guidance mentionspowershell -Command