Skip to content

fix(release): strip unused npm and corepack from bundled node - #238

Merged
cbartz merged 6 commits into
mainfrom
fix/strip-bundled-npm
Oct 13, 2026
Merged

cbartz merged 6 commits into
mainfrom
fix/strip-bundled-npm

Conversation

@cbartz

@cbartz cbartz commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Removes the npm and corepack that come bundled with Node 20 and 24 in externals/ from the release packages. This clears all High/Critical secscan findings in the runner tarballs (ISD-6336, SEC0025).

The runner only runs externals/node*/bin/node, so these copies are never used. They pin vulnerable dependencies such as tar, brace-expansion, minimatch, undici and ip-address. Upstream v2.338.0 doesn't fix them: Node 20 is unchanged, and Node 24.21.0 still ships vulnerable tar, brace-expansion and undici.

Changes

  • New script .github/scripts/strip-bundled-npm.sh: deletes lib/node_modules/{npm,corepack} and bin/{npm,npx,corepack} from every externals/node*. Both build.yml (PR CI) and release.yml run it right after layout, so shipped packages and CI artifacts match.
  • Checks: the step fails if no Node is found or if npm/corepack are still present, and it prints node --version for each bundled Node on hosts that can run them.
  • Fork-only: no file under src/ changes, so upstream merges and the arch patches are unaffected.

Verification

  • Script on the current release: ran the script on the v2.337.0 linux-x64 package. npm and corepack are gone, node24 still runs JavaScript, and the step fails on an empty layout.
  • secscan (trivy, archive): the unmodified v2.337.0 linux-x64 package has 51 CVEs; the stripped package has 0.
  • This PR's CI (build.yml): runs the script and the L0 tests on the stripped layout for all 5 architectures.

Risk

A workflow that calls the runner's bundled npm by its full path would break. The bundled npm is not on the PATH of job steps, and setup-node installs its own.

AI-generated message.

The runner only executes externals/node*/bin/node. The npm and corepack shipped
with Node 20 and 24 are never used, but they pin vulnerable dependencies (tar,
brace-expansion, minimatch, undici, ...) that account for all High/Critical
secscan findings in the release tarballs (ISD-6336).

Strip them after layout in the fork-only release workflow, so no upstream
source file changes and upstream merges stay conflict-free.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The stated all-architecture CI verification does not run for pull requests.

0 open findings

What changed in this PR

Removes unused bundled npm and corepack files from Node release packages to eliminate vulnerable dependencies.

Changes:

  • Deletes npm, npx, and corepack from bundled Node directories.
  • Validates Node presence, removal, and runtime execution.
File Summary
.github/​workflows/​release.yml Adds release-layout cleanup and validation; the check is not currently run in PR CI.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

release.yml only runs on release branches, so the strip and its checks never ran
for pull requests. Move the logic to .github/scripts/strip-bundled-npm.sh and call
it from both build.yml (PR CI, all 5 architectures) and release.yml.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Fix the validation bypass and verify all removed npm/Corepack entry points.

1 open finding

🧠 Review effort: Lite

Comment thread .github/scripts/strip-bundled-npm.sh Outdated
find | grep -q under pipefail can fail with SIGPIPE after a match and skip the
error. Use find -print -quit instead, and also check the npm/npx/corepack
launchers in bin/.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The script can allow an unusable Node layout to pass validation when bin/node is missing.

1 open finding
1 resolved since last review

🧠 Review effort: Lite

Comment thread .github/scripts/strip-bundled-npm.sh
The version check globbed bin/node and silently skipped Node directories without
one. Require bin/node in every bundled Node, including alpine and linux-arm where
it cannot be executed on the build host.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No unresolved review issues were identified.

0 open findings

1 resolved since last review

🧠 Review effort: Lite

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The Node smoke check currently masks execution failures.

1 open finding

🧠 Review effort: Balanced

Comment thread .github/scripts/strip-bundled-npm.sh Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused packaging change is correctly validated across the supported build matrix with no unresolved issues.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

@cbartz
cbartz marked this pull request as ready for review October 9, 2026 13:53
@cbartz
cbartz enabled auto-merge (squash) October 13, 2026 08:11
@cbartz
cbartz merged commit c851000 into main Oct 13, 2026
10 of 13 checks passed
@cbartz
cbartz deleted the fix/strip-bundled-npm branch October 13, 2026 08:46
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.

3 participants