Repository navigation
Windows: don't start a .cmd when cmd.exe would act on its arguments (1.2.2) - #186
Merged
Merged
Conversation
cross-spawn escapes for one reading by cmd.exe, but a .cmd or .bat reads its arguments again, and what arrives can differ from what cloudpin passed. src/exec.ts now refuses those calls on Windows: realExec returns a failure, so the check fails closed, and runInherited exits 127 with a message that names the kind of character and never the value. A plain double quote still passes when it leaves nothing outside the quotes, so JMESPath keeps working. .com and .exe, Linux and macOS are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The comment said a value could never be interpreted by cmd.exe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… form Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
The fix from 1.2.2 (released 2026-11-05, tag
v1.2.2onrelease/1.2.2), brought tomain, with 1.2.2's docs.On Windows, a value in a command could start another command through cmd.exe while cloudpin checked or ran that command, when the CLI is a
.cmdor.batfile. cross-spawn escapes arguments for cmd.exe, but a batch file reads them a second time.src/exec.tsnow refuses to start such a file when cmd.exe would act on its arguments: the check stops the command as "can't tell", andcloudpin execexits non-zero. The message names the kind of character, never a value. JMESPath with double quotes keeps working..exeCLIs, Linux and macOS are unaffected.src/exec.ts's comment and THREAT_MODEL.md's line said values could never be re-read by cmd.exe; both now say what's true.Evidence
npm run typecheckexit 0;npx vitest runpasses on main, and 2304 passed onv1.2.1plus the fix.test/exec-cmd-quote.test.tsfailed first (157 failing before the code existed). The real Linux and macOS spawn test is skipped on Windows; this PR's Linux job runs it.realExecand the inherit path, with printers shaped likeaz.cmd, npm's shim and a.bat: 716 intact, 280 refused with nothing run, none still different.realExec("az", [..., 'a"&kubectl'])ran a fake kubectl before the fix and doesn't after. Nightly was green on the release branch.cloudpin@1.2.2integrity equals the release tarball (1.2.1's differs); its attestation verifies, and a wrong-repo control fails.Not tested
No real CLI. gcloud, wrangler and supabase aren't installed here as
.cmd, so their batch files are unread.🤖 Generated with Claude Code