-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix(knife): GPG-verify Node.js SHASUMS256.txt.asc before committing checksums #2147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
loosebazooka
merged 5 commits into
GoogleContainerTools:main
from
rishuranjanofficial:fix/gpg-verify-node-shasums
Aug 31, 2026
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
53d6b23
fix: verify Node.js SHASUMS256.txt.asc GPG signature before trusting …
rishuranjanofficial 14401bb
gpg: verify Node.js checksums against committed release keys + daily …
rishuranjanofficial 3a87c1a
gpg: verify inline-signed SHASUMS via --decrypt; drop unsigned plaint…
rishuranjanofficial f0b4e13
knife: expose update-node-keys subcommand; call it from the workflow
rishuranjanofficial b93dd0b
knife: use execFileSync with arg arrays for gpg calls (no shell expan…
rishuranjanofficial File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| name: update-node-keys | ||
| on: | ||
| schedule: | ||
| - cron: "30 6 * * *" | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Update node release keys | ||
| run: ./knife.d/update_node_keys.sh | ||
|
|
||
| - name: Check for changes | ||
| run: | | ||
| if [[ $(git status --porcelain) ]]; then | ||
| echo "DISTROLESS_DIFF=true" >> "$GITHUB_ENV" | ||
| else | ||
| echo "No changes detected"; exit 0 | ||
| fi | ||
|
|
||
| - name: Create commits | ||
| if: env.DISTROLESS_DIFF | ||
| env: | ||
| ACTIONS_TOKEN: ${{ secrets.ACTIONS_TOKEN }} | ||
| run: | | ||
| git checkout -b update-node-keys | ||
| git config --global user.email "distroless-bot@google.com" | ||
| git config --global user.name "Distroless Bot" | ||
| git add knife.d/nodejs_keys.asc | ||
| git commit -s -m "Bumping Node.js release keys" | ||
| git remote set-url origin https://x-access-token:${ACTIONS_TOKEN}@github.com/${{ github.repository }}.git | ||
| git push --force origin HEAD | ||
|
|
||
| - name: Create Pull Request | ||
| if: env.DISTROLESS_DIFF | ||
| env: | ||
| GH_TOKEN: ${{ secrets.ACTIONS_TOKEN }} | ||
| run: | | ||
| if ! OUTPUT=$(gh pr create -B main -H update-node-keys --fill 2>&1) ; then | ||
| echo "$OUTPUT" | ||
| [[ "$OUTPUT" =~ "already exists" ]] && exit 0 || exit 1 | ||
| fi | ||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know our knife script structure is a bit silly. But update_node_keys.sh should be exposed directly in the knife script to be called like
./knife update-node-keysThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch - switched to gpg --output - --decrypt SHASUMS256.txt.asc, which verifies the inline signature and returns the authenticated checksums, and dropped the separate plaintext SHASUMS256.txt fetch so nothing unsigned is ever parsed. Validated against a real release (v22.11.0): good signature from a Node.js release signer + correct checksums, and confirmed it fails closed (non-zero exit) when the signer isn't in the committed keys. Pushed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added an update-node-keys subcommand to knife (cmd_update_node_keys) and switched the workflow to run ./knife update-node-keys, matching the update-node-archives pattern. Pushed.