Skip to content

Update cross-spawn and ws for the dependency audit - #159

Merged
bermanto merged 3 commits into
mainfrom
fix/cross-spawn-7-1
Dec 3, 2026
Merged

bermanto merged 3 commits into
mainfrom
fix/cross-spawn-7-1

Conversation

@bermanto

@bermanto bermanto commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Summary

pnpm audit --prod fails on main since 2026-12-01 because of two public advisories:

  • GHSA-ghv9-86vm-4v8m (critical): cross-spawn before 7.1.0 escapes arguments incorrectly for batch files outside node_modules/.bin. On Windows, the updater starts pnpm through cross-spawn, and pnpm is often a global batch file. cmd.exe reads its arguments a second time, so updater SQL with ", |, >, or % could reach wrangler changed. Stable 1.4.0 and 1.4.7 lock 7.0.6.
  • GHSA-37g9-w4hg-h9qr (high): ws before 8.23.0. It comes only from happy-dom (tests) and miniflare (local development). It is not in the Worker bundle.

This change:

  • Pins cross-spawn 7.1.2 and adds overrides for cross-spawn 7.1.2 and ws@8 8.23.1. Without the override, @modelcontextprotocol/sdk keeps 7.0.6. Both versions pass the minimum release age.
  • Adds oneLineSql() to scripts/shell.mjs. Since 7.1, cross-spawn throws a TypeError for a line break in a batch-file argument, because cmd.exe cannot carry it. Two updater queries span several lines: afterDeploySchemaSql and releaseInspectionSql. All five D1 --command callers now send their SQL on one line. The SQL has no -- comments, and a test checks this.

No documentation describes this argument handling, so no site change is necessary.

Tests

  • New Windows-only tests (quality-windows) start a real .cmd file outside node_modules/.bin that forwards %* to node:
    • Updater arguments with ', "from", ||, ->, %, &, |, >, ^, ( ), a path with spaces, and an unpaired quote arrive unchanged.
    • Both multi-line updater queries arrive unchanged after oneLineSql().
    • A raw line break is refused with a TypeError.
  • The first commit added only the first Windows test, and it passed on 7.0.6 in quality-windows. The updater SQL has its " in pairs, so cmd.exe still keeps | and > inside quotes on its second read. The last commit adds the advisory's own pattern, an argument with an unpaired quote. CI runs that case only with 7.1.2. A local simulation (with process.platform set to win32) shows the cmd.exe line for " & echo injected & ":
    • 7.0.6: ^"\^"^ ^&^ echo^ injected^ ^&^ \^"^". After the first read removes the carets, the batch file gets "\" & echo injected & \"", and its second read runs echo injected.
    • 7.1.2: """ & echo injected & """. The & stays inside quotes on both reads.
  • queryRemoteD1() and executeSql() tests check one-line SQL. They fail on the old helpers.
  • pnpm audit --prod --audit-level=moderate: no known vulnerabilities.
  • pnpm check passed: 1068 unit tests (5 skipped, including the Windows-only tests on macOS) and 232 integration tests. pnpm deploy:dry-run passed.

User-facing summary for the next Nightly: Update cross-spawn to 7.1.2 for GHSA-ghv9-86vm-4v8m. On Windows, the updater now sends its SQL to pnpm and wrangler on one line and with correct quoting.

🤖 Generated with Claude Code

On Windows, pnpm is often a global batch file outside node_modules/.bin.
cmd.exe reads the arguments of such a file a second time. This test sends
real updater arguments through a temporary batch file and checks that they
arrive unchanged. It fails with cross-spawn 7.0.6.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 51 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 29e0a152-39c7-4c1d-8992-c765328eb494
Commits

Reviewing files that changed from the base of the PR and between b836704 and 874bf40.

Files ignored due to path filters: 1

  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 10

  • package.json
  • pnpm-workspace.yaml
  • scripts/hqbase/domain-runtime.mjs
  • scripts/hqbase/recovery-verification.mjs
  • scripts/release/after-deploy-state.mjs
  • scripts/release/worker-deploy.mjs
  • scripts/shell.mjs
  • test/unit/scripts/after-deploy-state.test.mjs
  • test/unit/scripts/deploy.test.mjs
  • test/unit/scripts/shell.test.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

cross-spawn 7.1.2 fixes GHSA-ghv9-86vm-4v8m: arguments for batch files
outside node_modules/.bin, such as a global pnpm.cmd, now keep their
quoting when cmd.exe reads them again. ws 8.23.1 fixes GHSA-37g9-w4hg-h9qr
in test and local development tools. Overrides keep one version of each.

cross-spawn 7.1 refuses a line break in a batch-file argument, because
cmd.exe cannot carry it. The D1 helpers now send their SQL on one line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@socket-security

socket-security Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedcross-spawn@​7.0.6 ⏵ 7.1.299 +1100 +75100 +493100

View full report

The paired quotes in the updater SQL do not show the advisory: cmd.exe
still keeps their metacharacters inside quotes on its second read. An
argument with an unpaired quote does. With cross-spawn 7.0.6, cmd.exe
would run the rest of that argument as a command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bermanto
bermanto marked this pull request as ready for review December 3, 2026 02:11
@bermanto
bermanto merged commit e02964b into main Dec 3, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant