Skip to content

fix(npm): verify launcher downloads against checksums pinned at publish - #115

Merged
gabrielvfonseca merged 2 commits into
mainfrom
fix/npm-launcher-pinned-checksums
Oct 27, 2026
Merged

gabrielvfonseca merged 2 commits into
mainfrom
fix/npm-launcher-pinned-checksums

Conversation

@gabrielvfonseca

Copy link
Copy Markdown
Contributor

Summary

The launcher verified each download only against a .sha256 sidecar from the same GitHub release. A release replaced wholesale would pass that check.

  • scripts/pin-checksums.mjs runs in prepublishOnly (after the GitHub release exists). It downloads every platform binary, hashes the bytes, checks each hash against the release sidecar, and writes checksums.json into the package.
  • lib/download.mjs requires the downloaded bytes to match the pinned hash as well, and refuses when the pinned file is missing or is for another version.
  • allAssetNames() lists all five platform assets so the pin covers every platform.

Publish order

The GitHub release for v<version> must exist before npm publish, because the pin step downloads its binaries.

Verification

  • node --test tests/*.test.mjs: 33/33 pass, including new tests for version and missing-entry refusal, a binary that matches its sidecar but not the pin (refused), a genuine binary (installed), and pin-script disagreement.
  • scripts/pin-checksums.mjs 0.0.0-dev refuses.
  • Not run against a real published release; the pin step has not been exercised end to end.

🤖 Generated with Claude Code

The launcher only checked each binary against a .sha256 sidecar served from the
same GitHub release. A release replaced wholesale would pass that check. At
prepublish, scripts/pin-checksums.mjs now hashes every release binary, checks
it against its sidecar, and writes checksums.json into the package. The
launcher requires the downloaded bytes to match the pinned hash too, and
refuses when the pinned file is missing or for a different version.

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

coderabbitai Bot commented Oct 27, 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 25 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review 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: a4c78382-7f6c-49eb-b63f-c6d51258ae1a
Commits

Reviewing files that changed from the base of the PR and between 5896c5e and e90db35.

Files selected for processing: 8
  • npm/code-cli/README.md
  • npm/code-cli/lib/download.mjs
  • npm/code-cli/lib/pinned-checksums.mjs
  • npm/code-cli/lib/platform.mjs
  • npm/code-cli/package.json
  • npm/code-cli/scripts/pin-checksums.mjs
  • npm/code-cli/scripts/prepublish.sh
  • npm/code-cli/tests/pinned-checksums.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

Comment @coderabbitai help to get the list of available commands.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@gabrielvfonseca
gabrielvfonseca merged commit 829c240 into main Oct 27, 2026
12 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