fix(knife): GPG-verify Node.js SHASUMS256.txt.asc before committing checksums - #2147
Open
rishuranjanofficial wants to merge 1 commit into
Open
Conversation
…checksums Signed-off-by: rishuranjan <rishuranjan6@gmail.com>
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Author
|
I've submitted this pull request and would appreciate a review when you have some bandwidth. Please let me know if any changes or additional context are needed. Thank you for your time and consideration. |
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.
Problem
knife.d/update_node_archives.jscomputes SHA-256 checksums by downloadingeach Node.js tarball directly and hashing it locally. The resulting hashes are
committed to
private/extensions/node.bzland later used by Bazel to verifydownloads.
If the nodejs.org CDN, a reverse proxy, or DNS resolution is compromised at the
time the nightly
update-node-archivesworkflow runs, an attacker can serve amalicious tarball. The script will compute and commit the correct SHA-256 of the
malicious file — Bazel will then accept it on every subsequent build, silently
backdooring all
gcr.io/distroless/nodejs*images.Solution
Node.js publishes a GPG-signed
SHASUMS256.txt.ascalongside every release,signed by the Node.js release team's keys (documented at
https://github.com/nodejs/node#release-keys). Verifying this signature before
trusting any checksum establishes a chain of custody back to the Node.js release
team and eliminates the attack vector above.
This PR:
keyring at startup (with fallback to a secondary keyserver).
SHASUMS256.txtandSHASUMS256.txt.ascfor each Node.js version.gpg --verify— the script hard-fails if the signature does notvalidate, preventing any bad hashes from being committed.
SHASUMS256.txtto extract per-architecture SHA-256values, replacing the previous approach of hashing downloaded tarballs.
finallyblock.The nightly workflow already runs on
ubuntu-latest, which hasgpgpre-installed. No runner or workflow changes are required.
Security impact
Testing
Verified locally that:
by the previous tarball-hash approach.
creation.