test(cli): round-trip cmd.exe argument escaping through the shipped CLI - #1420
Merged
Simon Ingeson (smonn) merged 2 commits intoJul 31, 2026
Conversation
WalkthroughAdds workflow-level concurrency to cancel superseded CI runs. Replaces the generic npm spawn smoke test with direct Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Simon Ingeson (smonn)
force-pushed
the
wiz-11295-the-windows-ci-job-does-not-exercise-the-cmdexe-argument
branch
from
July 31, 2026 00:12
1d87e0e to
705a205
Compare
Simon Ingeson (smonn)
marked this pull request as ready for review
July 31, 2026 00:15
The windows-smoke job only passed --version through cmd.exe, an argument with no meta character, so every escapeArgument branch it guards ran on no runner. The unit suite is no help: it stays green with the escaping halved and with it removed, because four files assert the escaped shape rather than its effect. argv.cmd forwards %* to node, so arguments reach a real argv. Deleting escapeArgument reds 7 of the first 8 cases. The quote-then-metacharacter cases red under one caret layer, which is what proves the second layer load-bearing: cmd.exe ignores the backslash-escaped quote, so `a"&echo pwned` executes. doctorSmoke.mjs drives dist/cli.js so a call site that drops platform fails CI.
Simon Ingeson (smonn)
force-pushed
the
wiz-11295-the-windows-ci-job-does-not-exercise-the-cmdexe-argument
branch
from
July 31, 2026 00:26
298c1d3 to
95b1d30
Compare
Chase J (chajac)
approved these changes
Jul 31, 2026
Simon Ingeson (smonn)
deleted the
wiz-11295-the-windows-ci-job-does-not-exercise-the-cmdexe-argument
branch
July 31, 2026 01:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes WIZ-11295
Overview of Changes
The
windows-smokejob only ever passed--versionthroughcmd.exe, an argument with no meta character, so everyescapeArgumentbranch it exists to protect ran on no runner.argv.cmdforwards%*to node, so twelve arguments now reach a realargv.doctorSmoke.mjsdrivesdist/cli.jsinstead of a re-bundled copy, so a call site that dropsplatformfails CI.The unit suite was no help and still would not be: it stays green with the escaping halved and with it deleted, because four files assert the escaped shape rather than its effect. Both mutations were run on the runner to size that. The four quote-then-metacharacter cases are the interesting ones —
cmd.exeignores the backslash-escaped quoteescapeArgumentwrites, so under one caret layera"&echo pwnedcloses the quoted run and executes. That is what proves the second caret layer load-bearing, and it answers the open question the ticket carried.Testing
Only Windows CI can verify this; local runs skip. Run 30593534552 is green with 12/12 arguments round-tripping.
Checklist