Skip to content

feat(release): auto-refresh embedded signing keys in the release PR - #12798

Merged
zkochan merged 2 commits into
mainfrom
release-pr-auto-update-keys
Jul 4, 2026
Merged

zkochan merged 2 commits into
mainfrom
release-pr-auto-update-keys

Conversation

@zkochan

@zkochan zkochan commented Jul 4, 2026 •

Copy link
Copy Markdown
Member

Summary

The last dispatch of the Create Release PR workflow failed because the embedded Node.js release keys had drifted from the canonical nodejs/release-keys list (a new release signer was added), and the workflow treated any drift as a hard failure requiring a manual update PR first.

This PR makes the workflow self-healing: instead of failing, it now runs both key-update scripts (npm registry signing keys and Node.js release keys) in --update mode and commits the refreshed keys together with the version bumps, so new trust roots are reviewed as part of the release PR diff. When keys drifted, the workflow also synthesizes a changeset so the refresh shows up in the changelogs of the affected packages (@pnpm/deps.security.signatures / @pnpm/crypto.shasums-file) and pnpm, and posts an explicit ⚠️ comment on the release PR naming the refreshed trust roots, so a key change cannot slip through buried in a large version-bump diff.

It also lands the update that unblocks the pending release: the Node.js release team's new signing key 655F3B5C1FB3FA8D1A0CA6BDE4A7D232B936D2FD (Stewart X Addison) is embedded in both the TypeScript CLI and pacquet, in the exact form the generator produces, so the first automated refresh run starts from a clean, byte-identical baseline.

Fixing that baseline required generator fixes: the Rust output of update-node-release-keys.mjs no longer matched what the repo's linters accept — the header URL is now emitted in angle brackets (dylint perfectionist::bare-url) and raw-string hashes are only used when a key actually contains a quote (clippy needless_raw_string_hashes). update-npm-signing-keys.mjs now sorts the merged key set by keyid so a reordering of npm's response cannot churn the generated file or synthesize a spurious changeset.

Squash Commit Body

The create-release-pr workflow previously failed when the embedded npm
signing keys or Node.js release keys drifted from their canonical
sources, requiring a manual update PR before a release could proceed.
Now the workflow runs the update scripts in --update mode and commits
the refreshed keys together with the version bumps, so the new trust
roots are reviewed as part of the release PR diff. A synthesized
changeset records the refresh in the changelogs of the affected
packages, and an explicit warning comment on the release PR names the
refreshed trust roots so a key change cannot slip through unnoticed.

Also embeds the Node.js release team's new signing key
655F3B5C1FB3FA8D1A0CA6BDE4A7D232B936D2FD (Stewart X Addison), which the
last release run reported as missing, and fixes the generators:
update-node-release-keys.mjs emits lint-clean Rust (angle-bracket URL
for dylint's bare-url lint, raw-string hashes only when the key contains
a quote for clippy's needless_raw_string_hashes) that matches the
committed file byte-for-byte on a no-drift run, and
update-npm-signing-keys.mjs sorts the merged keys by keyid so a
reordering of npm's response cannot churn the generated file.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pacquet/ port, or the description notes what still needs porting.
    (The update script writes both stacks' key files; the new key is embedded in both.)
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests. (Covered by the existing signature-verification
    tests in @pnpm/crypto.shasums-file and pacquet-crypto-shasums-file, which
    parse the full embedded key set; no new test surface.)

Written by an agent (Claude Code, claude-fable-5).

Summary by CodeRabbit

  • New Features
    • Added an additional Node.js release signing key to verify newer SHASUMS256.txt signatures.
  • Bug Fixes
    • Release preparation now refreshes embedded signing/trust data automatically (no “up to date” skips), reducing failures caused by drift.
    • Improved key refresh output consistency to minimize unnecessary churn.
  • Documentation
    • Updated inline workflow guidance to reflect the new refresh and drift-review behavior.

The create-release-pr workflow previously failed when the embedded npm
signing keys or Node.js release keys drifted from their canonical
sources, requiring a manual update PR before a release could proceed.
Now the workflow runs the update scripts in --update mode and commits
the refreshed keys together with the version bumps, so the new trust
roots are reviewed as part of the release PR diff. A synthesized
changeset records the refresh in the changelogs of the affected
packages.

Also embeds the Node.js release team's new signing key
655F3B5C1FB3FA8D1A0CA6BDE4A7D232B936D2FD (Stewart X Addison), which the
last release run reported as missing, and fixes the Rust renderer in
update-node-release-keys.mjs so its output is lint-clean (angle-bracket
URL for dylint's bare-url lint, raw-string hashes only when the key
contains a quote for clippy's needless_raw_string_hashes) and matches
the committed file byte-for-byte on a no-drift run.
Copilot AI review requested due to automatic review settings July 4, 2026 18:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 19bbce8c-4255-4a70-8e93-cce4b2bd3ce0

📥 Commits

Reviewing files that changed from the base of the PR and between 0ccbf1c and 42c9592.

📒 Files selected for processing (3)
  • .github/workflows/create-release-pr.yml
  • pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs
  • pnpm11/deps/security/signatures/src/npmSigningKeys.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs
  • .github/workflows/create-release-pr.yml

📝 Walkthrough

Walkthrough

This PR adds a new Node.js release signing key to the embedded key stores, updates the key-refresh scripts and workflow to auto-commit key drift as changesets, and rewords related npm signing-key comments.

Changes

Node release key addition and automation

Layer / File(s) Summary
Add new Node release key to TS and Rust key stores
pnpm11/crypto/shasums-file/src/nodeReleaseKeys.ts, pacquet/crates/crypto-shasums-file/src/node_release_keys.rs, .changeset/add-sxa-node-release-key.md
A new NodeReleaseKey entry with fingerprint 655F3B5C1FB3FA8D1A0CA6BDE4A7D232B936D2FD and armored key is added to both TS and Rust key arrays, with a changeset recording the patch bump.
Update key generation script raw-string emission and docs
pnpm11/crypto/shasums-file/scripts/update-node-release-keys.mjs
Raw string emission now conditionally uses r"..." or r#"..."# based on quote content in armored keys; header comments are updated to describe --update and check-mode behavior under create-release-pr.
Update create-release-pr workflow to auto-refresh keys and generate changesets
.github/workflows/create-release-pr.yml
Replaces key-drift checks with unconditional refresh steps, writes .changeset/release-refresh-*.md files for changed key sets, exports drift state, and posts a review comment when trust roots changed.
Update npm signing key documentation comments
pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs, pnpm11/deps/security/signatures/src/npmSigningKeys.ts
Comments are reworded to reference create-release-pr refresh behavior, and the merged npm signing keys are sorted by keyid before rewriting.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • pnpm/pnpm#12201: Both PRs modify .github/workflows/create-release-pr.yml, and this change extends the same release-branch preparation flow with key refresh and drift handling.
  • pnpm/pnpm#12610: Both PRs modify pnpm11/crypto/shasums-file/scripts/update-node-release-keys.mjs, touching the same key-generation script.

Suggested labels: product: pnpm@11, product: pacquet

Suggested reviewers: qodo-free-for-open-source-projects

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch release-pr-auto-update-keys

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Auto-refresh embedded signing keys during release PR creation

✨ Enhancement ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Auto-update embedded npm and Node.js signing keys during Create Release PR workflow.
• Synthesize changesets when keys drift so trust-root refreshes appear in changelogs.
• Embed the new Node.js release signer key and make Rust key rendering lint-clean.
Diagram

graph TD
  A["Create Release PR workflow"] --> B["Update npm keys (--update)"] --> C["npmSigningKeys.ts"]
  A --> D["Update Node keys (--update)"] --> E["Node key modules"]
  A --> F["Synthesize changesets"] --> G[".changeset/*.md"]
  E --> E1["nodeReleaseKeys.ts"] --> E2["node_release_keys.rs"]
  B --> H{{"npm registry keys API"}}
  D --> I{{"nodejs/release-keys"}}
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Separate automated 'key refresh' PR workflow
  • ➕ Keeps release PR diffs focused on version bumps/changelogs
  • ➕ Allows faster security review/approval cadence independent of releases
  • ➕ Reduces chance of last-minute release PR growth
  • ➖ Adds another workflow to maintain and schedule
  • ➖ Still needs coordination so release PR picks up latest keys
  • ➖ May delay releases if refresh PR is pending review
2. Keep check-only gating and require manual key-update PRs
  • ➕ Strong explicit review barrier: releases never include trust-root changes
  • ➕ Simpler workflow logic (no auto-commit / synthesized changesets)
  • ➖ Operationally brittle; releases fail on upstream key drift
  • ➖ Higher maintainer toil; slows emergency releases
  • ➖ Encourages bypass/quick fixes under time pressure

Recommendation: The chosen approach (auto-refresh + commit into the release PR + synthesized changeset) is the best trade-off for reliability and reviewability: it prevents release pipeline breakage while still ensuring trust-root changes are visible in the PR diff and surfaced in changelogs. A separate key-refresh PR workflow is a reasonable future refinement if release PR size becomes a recurring review burden.

Files changed (7) +89 / -29

Enhancement (4) +40 / -14
node_release_keys.rsEmbed new Node.js release key in pacquet Rust key set +17/-0

Embed new Node.js release key in pacquet Rust key set

• Adds the Node.js release team's new PGP public key (fingerprint 655F...D2FD) to pacquet's embedded key list. Keeps Rust verification in sync with the TypeScript key set.

pacquet/crates/crypto-shasums-file/src/node_release_keys.rs

update-node-release-keys.mjsFix Node.js key generator output to satisfy Rust lints +10/-6

Fix Node.js key generator output to satisfy Rust lints

• Updates generator comments to reflect check vs update behavior under the release workflow. Adjusts Rust rendering to only use raw-string hash delimiters when needed and wraps the header URL in angle brackets to satisfy repository lints and keep generated output stable.

pnpm11/crypto/shasums-file/scripts/update-node-release-keys.mjs

nodeReleaseKeys.tsEmbed new Node.js release key in TypeScript key set +4/-0

Embed new Node.js release key in TypeScript key set

• Adds the new Node.js release signer key (655F...D2FD) to the embedded 'NODE_RELEASE_KEYS' array. Allows verification of SHASUMS signatures produced by the new releaser.

pnpm11/crypto/shasums-file/src/nodeReleaseKeys.ts

update-npm-signing-keys.mjsAlign npm key updater docs with release workflow auto-refresh +9/-8

Align npm key updater docs with release workflow auto-refresh

• Updates script documentation to reflect that the release workflow uses '--update' and check mode only reports drift. Clarifies that rotated keys will be reviewed in the release PR rather than causing a hard failure.

pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs

Documentation (2) +8 / -2
add-sxa-node-release-key.mdAdd changeset for new Node.js release signer key +6/-0

Add changeset for new Node.js release signer key

• Introduces a patch changeset noting the addition of Stewart X Addison's Node.js release signing key. Ensures the trust-root update is reflected in published changelogs for affected packages and pnpm.

.changeset/add-sxa-node-release-key.md

npmSigningKeys.tsUpdate embedded npm signing keys header comment for auto-refresh flow +2/-2

Update embedded npm signing keys header comment for auto-refresh flow

• Adjusts the module header comment to match the new release workflow behavior (auto-refresh instead of failing on drift). No functional key set change shown in this diff chunk.

pnpm11/deps/security/signatures/src/npmSigningKeys.ts

Other (1) +41 / -13
create-release-pr.ymlMake Create Release PR workflow self-healing for key drift +41/-13

Make Create Release PR workflow self-healing for key drift

• Replaces fail-fast key drift checks with '--update' runs for npm signing keys and Node.js release keys. Adds a step that generates changesets when either embedded key file changes so key refreshes are recorded before version bumping consumes pending changesets.

.github/workflows/create-release-pr.yml

@github-actions

github-actions Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
tarball/download_dependency    1.00      6.7±0.10ms   648.0 KB/sec    1.02      6.8±0.35ms   637.1 KB/sec

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jul 4, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Workflow heredoc never terminates 🐞 Bug ☼ Reliability
Description
In create-release-pr.yml, the new synthesized changeset creation uses an indented <<'EOF'
heredoc, so bash will not recognize the terminator and the step will fail (preventing pnpm bump /
release PR creation). This also risks emitting changeset frontmatter with leading spaces, which
changeset tooling typically won’t parse as valid --- frontmatter.
Code

.github/workflows/create-release-pr.yml[R75-82]

+          cat > .changeset/release-refresh-npm-signing-keys.md <<'EOF'
+        ---
+        "@pnpm/deps.security.signatures": patch
+        "pnpm": patch
+        ---
+
+        Updated the embedded npm registry signing keys to the set currently advertised by npm.
+        EOF
Evidence
The workflow currently indents the heredoc body and the EOF line, which bash will not treat as the
heredoc terminator; and existing changeset files use unindented --- frontmatter.

.github/workflows/create-release-pr.yml[69-93]
.changeset/bugs-issues-alias.md[1-4]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The workflow step that writes synthesized changesets uses a heredoc whose body and closing delimiter are indented. In bash, the heredoc terminator must start at column 1 (unless using `<<-` with *tab*-indented content), so the step will fail.
### Issue Context
This breaks the newly-added “Add changesets for refreshed keys” step, which is intended to run before `pnpm bump`.
### Fix Focus Areas
- .github/workflows/create-release-pr.yml[69-93]
### Suggested fix
Rewrite the `cat` blocks so both the content and the `EOF` terminator are unindented, e.g.:

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. PR comment may fail 🐞 Bug ☼ Reliability ⭐ New
Description
The new “Flag refreshed trust roots on the PR” step unconditionally runs gh pr comment using a PR
number derived from gh pr list --jq '.[0].number'. If no open PR is returned (empty list ⇒
empty/null), this final step fails the whole workflow run even though the release branch was
pushed successfully.
Code

.github/workflows/create-release-pr.yml[R165-166]

+        PR=$(gh pr list --head "release-pr/$TARGET" --state open --json number --jq '.[0].number')
+        gh pr comment "$PR" --body "⚠️ This release refreshes embedded trust roots: **${DRIFTED}**. Review those key diffs deliberately before merging — they gate signature verification of Node.js runtimes and package-manager binaries."
Evidence
The workflow currently assigns PR from gh pr list ... --jq '.[0].number' and uses it directly in
gh pr comment without checking for empty/null, making the step (and job) fail if no open PR is
returned.

.github/workflows/create-release-pr.yml[158-166]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The workflow step `Flag refreshed trust roots on the PR` assumes `gh pr list` always returns an open PR, then calls `gh pr comment` with whatever came back. When no PR is found (or the query returns `null`), the step fails and the entire workflow run fails.

### Issue Context
This step is meant to be a visibility signal; it shouldn’t be able to block the overall release PR automation.

### Fix Focus Areas
- .github/workflows/create-release-pr.yml[158-166]

### Suggested fix
- Add a guard so the step is a no-op when the PR number is empty/`null`:
 - Fetch PR number
 - If `PR` is empty or equals `null`, print a warning and `exit 0`
 - Otherwise, post the comment

Optionally: capture the PR number in the “Create PR if needed” step (existing or newly created) and pass it via `GITHUB_OUTPUT`, so the comment step doesn’t need another list query.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Key refresh output order churn ✓ Resolved 🐞 Bug ⚙ Maintainability
Description
Because the release workflow now always runs the npm signing key updater in --update mode, any
upstream reordering of the npm keys array can rewrite npmSigningKeys.ts (even if the key set is
unchanged), triggering noisy diffs and potentially causing an unnecessary synthesized
changeset/version bump. The updater preserves the registry response order and always renders/writes
the merged array without canonical sorting.
Code

.github/workflows/create-release-pr.yml[R59-61]

+    - name: Update embedded npm signing keys
+      run: node pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs --update
+
Evidence
The workflow step now runs update-npm-signing-keys.mjs --update, and the script constructs `merged
= [...npmKeys]` directly from the registry JSON order and then writes the rendered file.

.github/workflows/create-release-pr.yml[53-67]
pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs[22-50]
pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs[52-58]
pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs[84-101]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The workflow runs the npm key updater with `--update`, and the updater emits keys in whatever order the npm registry returns. If npm changes ordering (without changing keys), the generated TS file will still change, creating release PR noise and potentially unnecessary changesets/version bumps.
### Issue Context
This becomes more impactful now that the update runs automatically during release PR creation.
### Fix Focus Areas
- pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs[22-58]
- pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs[84-101]
### Suggested fix
Canonicalize ordering before rendering, e.g. sort `merged` deterministically (by `keyid`, then maybe `expires`), and optionally avoid writing if the newly-rendered content is byte-identical to the existing file.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Auto-committed trust roots ✓ Resolved 🐞 Bug ⛨ Security
Description
The release workflow now fetches trust roots from external endpoints (npm registry keys +
nodejs/release-keys) and force-pushes them into the release PR branch, so a compromised upstream
source (or a missed review signal in a large version-bump PR) could inject malicious signing keys
that later gate pnpm/pacquet authenticity checks. Previously, drift caused a hard failure that
forced an explicit, dedicated human update PR; this change removes that safety rail without adding
an equally-strong explicit review checkpoint for trust-root changes.
Code

.github/workflows/create-release-pr.yml[R53-67]

+    # Refresh the npm registry signing keys embedded in
+    # @pnpm/deps.security.signatures from what npm advertises. pnpm verifies
+    # package-manager binaries (pacquet, the version-switch pnpm) against these
+    # keys, so a stale set could break verification after a key rotation. Any
+    # drift is committed below along with the version bumps, so the new trust
+    # roots are reviewed as part of the release PR diff.
+    - name: Update embedded npm signing keys
+      run: node pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs --update
+
+    # Refresh the embedded Node.js release keys (used to verify the signature of
+    # a downloaded runtime's SHASUMS256.txt) from the canonical
+    # nodejs/release-keys list, so a new release signer cannot break Node.js
+    # runtime verification. Reviewed in the release PR diff like the npm keys.
+    - name: Update embedded Node.js release keys
+      run: node pnpm11/crypto/shasums-file/scripts/update-node-release-keys.mjs --update
Evidence
The workflow now runs both key-update scripts in write mode and then commits/pushes the resulting
changes to the release PR branch; those scripts fetch key material from remote endpoints and rewrite
the embedded trust stores that are used as pinned trust roots for signature verification of Node.js
SHASUMS and package-manager binaries.

.github/workflows/create-release-pr.yml[53-67]
.github/workflows/create-release-pr.yml[115-146]
pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs[18-58]
pnpm11/crypto/shasums-file/scripts/update-node-release-keys.mjs[17-61]
pnpm11/deps/security/signatures/src/verifySignatures.ts[385-395]
pnpm11/crypto/shasums-file/src/verifyNodeShasums.ts[25-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The create-release-pr workflow now auto-refreshes and commits embedded signing keys from remote sources into the release PR. This expands the supply-chain risk window: externally sourced trust-root diffs can be merged as part of a routine release PR unless reviewers notice and explicitly evaluate them.
## Issue Context
This PR intentionally changes from "fail on drift" to "self-heal by committing refreshed keys". The missing piece is an explicit, hard-to-miss review signal/checkpoint tailored to trust-root changes.
## Fix Focus Areas
- .github/workflows/create-release-pr.yml[53-93]
## Suggested remediation
Implement one (or more) of the following workflow guardrails when key files change:
1) **Make trust-root changes explicit in the PR creation step**
- If key files changed, compute a concise summary (e.g., list added/removed fingerprints / keyids) and append it to the PR body, or add it to the GitHub Actions Step Summary.
2) **Split commits**
- Commit refreshed keys (and synthesized changesets) in a dedicated commit before running `pnpm bump`, so reviewers can easily isolate and review trust-root updates.
3) **Add a mandatory label/review requirement**
- If key files changed, automatically apply a label like `security:trust-roots` and/or request review from a CODEOWNERS/security team (depending on repo policies).
4) **Reduce ambient token permissions**
- Consider setting `permissions: contents: read, pull-requests: read` at the workflow/job level and rely on the scoped PAT only in the specific push/PR steps, reducing the impact of any unexpected code execution earlier in the job.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Previous review results

Review updated until commit 42c9592

Results up to commit 42c9592


🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)


Action required
1. Workflow heredoc never terminates 🐞 Bug ☼ Reliability
Description
In create-release-pr.yml, the new synthesized changeset creation uses an indented <<'EOF'
heredoc, so bash will not recognize the terminator and the step will fail (preventing pnpm bump /
release PR creation). This also risks emitting changeset frontmatter with leading spaces, which
changeset tooling typically won’t parse as valid --- frontmatter.
Code

.github/workflows/create-release-pr.yml[R75-82]

+          cat > .changeset/release-refresh-npm-signing-keys.md <<'EOF'
+        ---
+        "@pnpm/deps.security.signatures": patch
+        "pnpm": patch
+        ---
+
+        Updated the embedded npm registry signing keys to the set currently advertised by npm.
+        EOF
Evidence
The workflow currently indents the heredoc body and the EOF line, which bash will not treat as the
heredoc terminator; and existing changeset files use unindented --- frontmatter.

.github/workflows/create-release-pr.yml[69-93]
.changeset/bugs-issues-alias.md[1-4]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The workflow step that writes synthesized changesets uses a heredoc whose body and closing delimiter are indented. In bash, the heredoc terminator must start at column 1 (unless using `<<-` with *tab*-indented content), so the step will fail.
### Issue Context
This breaks the newly-added “Add changesets for refreshed keys” step, which is intended to run before `pnpm bump`.
### Fix Focus Areas
- .github/workflows/create-release-pr.yml[69-93]
### Suggested fix
Rewrite the `cat` blocks so both the content and the `EOF` terminator are unindented, e.g.:

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended
2. Key refresh output order churn ✓ Resolved 🐞 Bug ⚙ Maintainability
Description
Because the release workflow now always runs the npm signing key updater in --update mode, any
upstream reordering of the npm keys array can rewrite npmSigningKeys.ts (even if the key set is
unchanged), triggering noisy diffs and potentially causing an unnecessary synthesized
changeset/version bump. The updater preserves the registry response order and always renders/writes
the merged array without canonical sorting.
Code

.github/workflows/create-release-pr.yml[R59-61]

+    - name: Update embedded npm signing keys
+      run: node pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs --update
+
Evidence
The workflow step now runs update-npm-signing-keys.mjs --update, and the script constructs `merged
= [...npmKeys]` directly from the registry JSON order and then writes the rendered file.

.github/workflows/create-release-pr.yml[53-67]
pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs[22-50]
pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs[52-58]
pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs[84-101]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The workflow runs the npm key updater with `--update`, and the updater emits keys in whatever order the npm registry returns. If npm changes ordering (without changing keys), the generated TS file will still change, creating release PR noise and potentially unnecessary changesets/version bumps.
### Issue Context
This becomes more impactful now that the update runs automatically during release PR creation.
### Fix Focus Areas
- pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs[22-58]
- pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs[84-101]
### Suggested fix
Canonicalize ordering before rendering, e.g. sort `merged` deterministically (by `keyid`, then maybe `expires`), and optionally avoid writing if the newly-rendered content is byte-identical to the existing file.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Auto-committed trust roots ✓ Resolved 🐞 Bug ⛨ Security
Description
The release workflow now fetches trust roots from external endpoints (npm registry keys +
nodejs/release-keys) and force-pushes them into the release PR branch, so a compromised upstream
source (or a missed review signal in a large version-bump PR) could inject malicious signing keys
that later gate pnpm/pacquet authenticity checks. Previously, drift caused a hard failure that
forced an explicit, dedicated human update PR; this change removes that safety rail without adding
an equally-strong explicit review checkpoint for trust-root changes.
Code

.github/workflows/create-release-pr.yml[R53-67]

+    # Refresh the npm registry signing keys embedded in
+    # @pnpm/deps.security.signatures from what npm advertises. pnpm verifies
+    # package-manager binaries (pacquet, the version-switch pnpm) against these
+    # keys, so a stale set could break verification after a key rotation. Any
+    # drift is committed below along with the version bumps, so the new trust
+    # roots are reviewed as part of the release PR diff.
+    - name: Update embedded npm signing keys
+      run: node pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs --update
+
+    # Refresh the embedded Node.js release keys (used to verify the signature of
+    # a downloaded runtime's SHASUMS256.txt) from the canonical
+    # nodejs/release-keys list, so a new release signer cannot break Node.js
+    # runtime verification. Reviewed in the release PR diff like the npm keys.
+    - name: Update embedded Node.js release keys
+      run: node pnpm11/crypto/shasums-file/scripts/update-node-release-keys.mjs --update
Evidence
The workflow now runs both key-update scripts in write mode and then commits/pushes the resulting
changes to the release PR branch; those scripts fetch key material from remote endpoints and rewrite
the embedded trust stores that are used as pinned trust roots for signature verification of Node.js
SHASUMS and package-manager binaries.

.github/workflows/create-release-pr.yml[53-67]
.github/workflows/create-release-pr.yml[115-146]
pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs[18-58]
pnpm11/crypto/shasums-file/scripts/update-node-release-keys.mjs[17-61]
pnpm11/deps/security/signatures/src/verifySignatures.ts[385-395]
pnpm11/crypto/shasums-file/src/verifyNodeShasums.ts[25-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The create-release-pr workflow now auto-refreshes and commits embedded signing keys from remote sources into the release PR. This expands the supply-chain risk window: externally sourced trust-root diffs can be merged as part of a routine release PR unless reviewers notice and explicitly evaluate them.
## Issue Context
This PR intentionally changes from "fail on drift" to "self-heal by committing refreshed keys". The missing piece is an explicit, hard-to-miss review signal/checkpoint tailored to trust-root changes.
## Fix Focus Areas
- .github/workflows/create-release-pr.yml[53-93]
## Suggested remediation
Implement one (or more) of the following workflow guardrails when key files change:
1) **Make trust-root changes explicit in the PR creation step**
- If key files changed, compute a concise summary (e.g., list added/removed fingerprints / keyids) and append it to the PR body, or add it to the GitHub Actions Step Summary.
2) **Split commits**
- Commit refreshed keys (and synthesized changesets) in a dedicated commit before running `pnpm bump`, so reviewers can easily isolate and review trust-root updates.
3) **Add a mandatory label/review requirement**
- If key files changed, automatically apply a label like `security:trust-roots` and/or request review from a CODEOWNERS/security team (depending on repo policies).
4) **Reduce ambient token permissions**
- Consider setting `permissions: contents: read, pull-requests: read` at the workflow/job level and rely on the scoped PAT only in the specific push/PR steps, reducing the impact of any unexpected code execution earlier in the job.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit 0ccbf1c


🐞 Bugs (3) 📘 Rule violations (0) 📜 Skill insights (0)


Action required
1. Workflow heredoc never terminates 🐞 Bug ☼ Reliability ⭐ New
Description
In create-release-pr.yml, the new synthesized changeset creation uses an indented <<'EOF'
heredoc, so bash will not recognize the terminator and the step will fail (preventing pnpm bump /
release PR creation). This also risks emitting changeset frontmatter with leading spaces, which
changeset tooling typically won’t parse as valid --- frontmatter.
Code

.github/workflows/create-release-pr.yml[R75-82]

+          cat > .changeset/release-refresh-npm-signing-keys.md <<'EOF'
+        ---
+        "@pnpm/deps.security.signatures": patch
+        "pnpm": patch
+        ---
+
+        Updated the embedded npm registry signing keys to the set currently advertised by npm.
+        EOF
Evidence
The workflow currently indents the heredoc body and the EOF line, which bash will not treat as the
heredoc terminator; and existing changeset files use unindented --- frontmatter.

.github/workflows/create-release-pr.yml[69-93]
.changeset/bugs-issues-alias.md[1-4]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The workflow step that writes synthesized changesets uses a heredoc whose body and closing delimiter are indented. In bash, the heredoc terminator must start at column 1 (unless using `<<-` with *tab*-indented content), so the step will fail.

### Issue Context
This breaks the newly-added “Add changesets for refreshed keys” step, which is intended to run before `pnpm bump`.

### Fix Focus Areas
- .github/workflows/create-release-pr.yml[69-93]

### Suggested fix
Rewrite the `cat` blocks so both the content and the `EOF` terminator are unindented, e.g.:

```bash
if ! git diff --quiet -- path/to/file; then
cat > .changeset/foo.md <<'EOF'
---
"pkg": patch
---

Message
EOF
fi
```

Apply the same fix to both synthesized changesets in that step.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended
2. Key refresh output order churn 🐞 Bug ⚙ Maintainability ⭐ New
Description
Because the release workflow now always runs the npm signing key updater in --update mode, any
upstream reordering of the npm keys array can rewrite npmSigningKeys.ts (even if the key set is
unchanged), triggering noisy diffs and potentially causing an unnecessary synthesized
changeset/version bump. The updater preserves the registry response order and always renders/writes
the merged array without canonical sorting.
Code

.github/workflows/create-release-pr.yml[R59-61]

+    - name: Update embedded npm signing keys
+      run: node pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs --update
+
Evidence
The workflow step now runs update-npm-signing-keys.mjs --update, and the script constructs `merged
= [...npmKeys]` directly from the registry JSON order and then writes the rendered file.

.github/workflows/create-release-pr.yml[53-67]
pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs[22-50]
pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs[52-58]
pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs[84-101]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The workflow runs the npm key updater with `--update`, and the updater emits keys in whatever order the npm registry returns. If npm changes ordering (without changing keys), the generated TS file will still change, creating release PR noise and potentially unnecessary changesets/version bumps.

### Issue Context
This becomes more impactful now that the update runs automatically during release PR creation.

### Fix Focus Areas
- pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs[22-58]
- pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs[84-101]

### Suggested fix
Canonicalize ordering before rendering, e.g. sort `merged` deterministically (by `keyid`, then maybe `expires`), and optionally avoid writing if the newly-rendered content is byte-identical to the existing file.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Auto-committed trust roots 🐞 Bug ⛨ Security
Description
The release workflow now fetches trust roots from external endpoints (npm registry keys +
nodejs/release-keys) and force-pushes them into the release PR branch, so a compromised upstream
source (or a missed review signal in a large version-bump PR) could inject malicious signing keys
that later gate pnpm/pacquet authenticity checks. Previously, drift caused a hard failure that
forced an explicit, dedicated human update PR; this change removes that safety rail without adding
an equally-strong explicit review checkpoint for trust-root changes.
Code

.github/workflows/create-release-pr.yml[R53-67]

+    # Refresh the npm registry signing keys embedded in
+    # @pnpm/deps.security.signatures from what npm advertises. pnpm verifies
+    # package-manager binaries (pacquet, the version-switch pnpm) against these
+    # keys, so a stale set could break verification after a key rotation. Any
+    # drift is committed below along with the version bumps, so the new trust
+    # roots are reviewed as part of the release PR diff.
+    - name: Update embedded npm signing keys
+      run: node pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs --update
+
+    # Refresh the embedded Node.js release keys (used to verify the signature of
+    # a downloaded runtime's SHASUMS256.txt) from the canonical
+    # nodejs/release-keys list, so a new release signer cannot break Node.js
+    # runtime verification. Reviewed in the release PR diff like the npm keys.
+    - name: Update embedded Node.js release keys
+      run: node pnpm11/crypto/shasums-file/scripts/update-node-release-keys.mjs --update
Evidence
The workflow now runs both key-update scripts in write mode and then commits/pushes the resulting
changes to the release PR branch; those scripts fetch key material from remote endpoints and rewrite
the embedded trust stores that are used as pinned trust roots for signature verification of Node.js
SHASUMS and package-manager binaries.

.github/workflows/create-release-pr.yml[53-67]
.github/workflows/create-release-pr.yml[115-146]
pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs[18-58]
pnpm11/crypto/shasums-file/scripts/update-node-release-keys.mjs[17-61]
pnpm11/deps/security/signatures/src/verifySignatures.ts[385-395]
pnpm11/crypto/shasums-file/src/verifyNodeShasums.ts[25-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The create-release-pr workflow now auto-refreshes and commits embedded signing keys from remote sources into the release PR. This expands the supply-chain risk window: externally sourced trust-root diffs can be merged as part of a routine release PR unless reviewers notice and explicitly evaluate them.
## Issue Context
This PR intentionally changes from "fail on drift" to "self-heal by committing refreshed keys". The missing piece is an explicit, hard-to-miss review signal/checkpoint tailored to trust-root changes.
## Fix Focus Areas
- .github/workflows/create-release-pr.yml[53-93]
## Suggested remediation
Implement one (or more) of the following workflow guardrails when key files change:
1) **Make trust-root changes explicit in the PR creation step**
 - If key files changed, compute a concise summary (e.g., list added/removed fingerprints / keyids) and append it to the PR body, or add it to the GitHub Actions Step Summary.
2) **Split commits**
 - Commit refreshed keys (and synthesized changesets) in a dedicated commit before running `pnpm bump`, so reviewers can easily isolate and review trust-root updates.
3) **Add a mandatory label/review requirement**
 - If key files changed, automatically apply a label like `security:trust-roots` and/or request review from a CODEOWNERS/security team (depending on repo policies).
4) **Reduce ambient token permissions**
 - Consider setting `permissions: contents: read, pull-requests: read` at the workflow/job level and rely on the scoped PAT only in the specific push/PR steps, reducing the impact of any unexpected code execution earlier in the job.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


ⓘ  1 issues published inline · 2 in summary

Results up to commit 0ccbf1c


🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)


Remediation recommended
1. Auto-committed trust roots 🐞 Bug ⛨ Security
Description
The release workflow now fetches trust roots from external endpoints (npm registry keys +
nodejs/release-keys) and force-pushes them into the release PR branch, so a compromised upstream
source (or a missed review signal in a large version-bump PR) could inject malicious signing keys
that later gate pnpm/pacquet authenticity checks. Previously, drift caused a hard failure that
forced an explicit, dedicated human update PR; this change removes that safety rail without adding
an equally-strong explicit review checkpoint for trust-root changes.
Code

.github/workflows/create-release-pr.yml[R53-67]

+    # Refresh the npm registry signing keys embedded in
+    # @pnpm/deps.security.signatures from what npm advertises. pnpm verifies
+    # package-manager binaries (pacquet, the version-switch pnpm) against these
+    # keys, so a stale set could break verification after a key rotation. Any
+    # drift is committed below along with the version bumps, so the new trust
+    # roots are reviewed as part of the release PR diff.
+    - name: Update embedded npm signing keys
+      run: node pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs --update
+
+    # Refresh the embedded Node.js release keys (used to verify the signature of
+    # a downloaded runtime's SHASUMS256.txt) from the canonical
+    # nodejs/release-keys list, so a new release signer cannot break Node.js
+    # runtime verification. Reviewed in the release PR diff like the npm keys.
+    - name: Update embedded Node.js release keys
+      run: node pnpm11/crypto/shasums-file/scripts/update-node-release-keys.mjs --update
Evidence
The workflow now runs both key-update scripts in write mode and then commits/pushes the resulting
changes to the release PR branch; those scripts fetch key material from remote endpoints and rewrite
the embedded trust stores that are used as pinned trust roots for signature verification of Node.js
SHASUMS and package-manager binaries.

.github/workflows/create-release-pr.yml[53-67]
.github/workflows/create-release-pr.yml[115-146]
pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs[18-58]
pnpm11/crypto/shasums-file/scripts/update-node-release-keys.mjs[17-61]
pnpm11/deps/security/signatures/src/verifySignatures.ts[385-395]
pnpm11/crypto/shasums-file/src/verifyNodeShasums.ts[25-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The create-release-pr workflow now auto-refreshes and commits embedded signing keys from remote sources into the release PR. This expands the supply-chain risk window: externally sourced trust-root diffs can be merged as part of a routine release PR unless reviewers notice and explicitly evaluate them.

## Issue Context
This PR intentionally changes from "fail on drift" to "self-heal by committing refreshed keys". The missing piece is an explicit, hard-to-miss review signal/checkpoint tailored to trust-root changes.

## Fix Focus Areas
- .github/workflows/create-release-pr.yml[53-93]

## Suggested remediation
Implement one (or more) of the following workflow guardrails when key files change:
1) **Make trust-root changes explicit in the PR creation step**
  - If key files changed, compute a concise summary (e.g., list added/removed fingerprints / keyids) and append it to the PR body, or add it to the GitHub Actions Step Summary.
2) **Split commits**
  - Commit refreshed keys (and synthesized changesets) in a dedicated commit before running `pnpm bump`, so reviewers can easily isolate and review trust-root updates.
3) **Add a mandatory label/review requirement**
  - If key files changed, automatically apply a label like `security:trust-roots` and/or request review from a CODEOWNERS/security team (depending on repo policies).
4) **Reduce ambient token permissions**
  - Consider setting `permissions: contents: read, pull-requests: read` at the workflow/job level and rely on the scoped PAT only in the specific push/PR steps, reducing the impact of any unexpected code execution earlier in the job.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Qodo Logo

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 0ccbf1c

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/create-release-pr.yml:
- Around line 69-93: The heredoc blocks in the Add changesets for refreshed keys
step are indented, so the EOF terminators will not be recognized and the
generated .changeset files will keep leading spaces. Update the workflow snippet
around the two cat <<'EOF' sections so the heredoc delimiters and contents are
flush to column 0, preserving valid changeset frontmatter when the step runs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f1f7f46e-6454-42b1-8564-937925352e3a

📥 Commits

Reviewing files that changed from the base of the PR and between d539172 and 0ccbf1c.

📒 Files selected for processing (7)
  • .changeset/add-sxa-node-release-key.md
  • .github/workflows/create-release-pr.yml
  • pacquet/crates/crypto-shasums-file/src/node_release_keys.rs
  • pnpm11/crypto/shasums-file/scripts/update-node-release-keys.mjs
  • pnpm11/crypto/shasums-file/src/nodeReleaseKeys.ts
  • pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs
  • pnpm11/deps/security/signatures/src/npmSigningKeys.ts

Comment thread .github/workflows/create-release-pr.yml Resolved
@codecov-commenter

codecov-commenter commented Jul 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.06%. Comparing base (d539172) to head (42c9592).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12798      +/-   ##
==========================================
- Coverage   85.06%   85.06%   -0.01%     
==========================================
  Files         415      415              
  Lines       65533    65533              
==========================================
- Hits        55746    55744       -2     
- Misses       9787     9789       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Review follow-ups: sort the merged npm signing keys by keyid so a
reordering of npm's response cannot churn the generated file or
synthesize a spurious changeset, and leave an explicit warning comment
on the release PR whenever embedded trust roots were refreshed, so a
key change cannot slip through buried in a large version-bump diff.
@zkochan

zkochan commented Jul 4, 2026

Copy link
Copy Markdown
Member Author

Responding to the Qodo review findings:

1. Workflow heredoc never terminates — false positive. The run: block is a YAML literal block scalar; YAML strips the block indentation before the runner hands the script to bash, so bash receives the heredoc bodies and EOF terminators at column 0 and the changeset frontmatter is written flush-left. Verified by extracting the step with a YAML parser and executing it with drift forced: both .changeset/*.md files come out with valid unindented frontmatter and the step exits 0.

2. Key refresh output order churn — fixed in 42c9592. update-npm-signing-keys.mjs now sorts the merged key set by keyid before rendering, so a reordering of npm's response can no longer rewrite the file or synthesize a spurious changeset. The embedded file was regenerated in the same commit so the committed baseline is already in canonical order. (The Node.js release keys already follow the order of the canonical keys.list file, which is deterministic upstream content, not a JSON API response.)

3. Auto-committed trust roots — the move from fail-on-drift to auto-refresh is intentional: the hard failure blocked releases and still ended with a human running the same scripts against the same endpoints, so it added friction without adding an independent verification step. That said, the review-signal concern is fair, and 42c9592 addresses it: whenever the workflow refreshes either key set, it now posts an explicit ⚠️ comment on the release PR naming the refreshed trust roots, in addition to the synthesized changeset that records the refresh in the changelogs. A trust-root diff can no longer merge without a visible, dedicated signal on the PR.


Written by an agent (Claude Code, claude-fable-5).

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 4, 2026
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 42c9592

@zkochan
zkochan merged commit 2f389d6 into main Jul 4, 2026
33 checks passed
@zkochan
zkochan deleted the release-pr-auto-update-keys branch July 4, 2026 18:47
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 42c9592

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet product: pnpm@11 reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants