Skip to content

fix(release): verify all npm release tarballs - #13045

Merged
zkochan merged 4 commits into
mainfrom
fix/verify-rust-release-artifacts
Jul 15, 2026
Merged

zkochan merged 4 commits into
mainfrom
fix/verify-rust-release-artifacts

Conversation

@zkochan

@zkochan zkochan commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds pre-publish verification gates for every npm package released by this workflow: Rust pacquet, the v11 JavaScript CLI and @pnpm/exe, and pnpr. Dedicated read-only verification jobs pack generated packages, verify declared literal payload files are non-empty and byte-for-byte identical to their source artifacts, and smoke-test the relevant installed command before a separate trusted-publishing job can run.

Squash Commit Body

Release jobs could package and publish generated native or executable payloads
without a release-time signal if a packlist regression omitted a required file.
Add read-only verification jobs before each trusted-publishing job. They pack every
generated package, verify its declared literal payload files against the source
artifacts, and smoke-test the v11 plain-JS CLI, the v11 executable wrapper
with its native package, and the pnpr wrapper with its Linux native package.

Keeping the smoke tests outside OIDC-enabled publishing jobs prevents an
artifact executed during verification from obtaining a trusted-publishing token.
The verification tarballs live outside package directories so they cannot become
part of subsequently published archives.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting. (Release
    workflow only.)
  • 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.
  • Updated the documentation if needed.

Written by an agent (Codex, GPT-5).


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Bug Fixes
    • Added stronger pre-publication checks to ensure generated npm packages match the exact staged sources byte-for-byte.
    • Validates all declared payload files are included and identical to the originals.
  • Tests
    • Added a Linux-x64 style install/run smoke test to confirm the wrapper setup and main executable work correctly after extraction.
  • CI / Release
    • Updated the release pipeline to run artifact verification for all supported product lines and tightened the publish steps for cleaner, deterministic packaging.

Copilot AI review requested due to automatic review settings July 15, 2026 18:26

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 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@zkochan, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 4 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: acf065cf-762a-4074-a3bf-45562e501a81

📥 Commits

Reviewing files that changed from the base of the PR and between 7f36ae1 and 8c81259.

📒 Files selected for processing (1)
  • .github/workflows/release.yml
📝 Walkthrough

Walkthrough

The release workflow adds artifact verification jobs for TypeScript, Rust, and pnpr packages. Each job compares packed payloads with staged files, runs an installation smoke test, and gates the corresponding publish job.

Changes

Release artifact verification

Layer / File(s) Summary
TypeScript artifact verification
.github/workflows/release.yml
Builds executable artifacts, validates packed files with SHA256, smoke-tests pnpm installation, and gates the TypeScript release job.
Rust artifact verification
.github/workflows/release.yml
Validates generated Rust and wrapper packages, smoke-tests Linux pnpm installation, and gates Rust publishing.
pnpr artifact verification
.github/workflows/release.yml
Validates pnpr packages, smoke-tests installation and pnpr --version, gates publishing, and simplifies package preparation commands.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ReleaseWorkflow
  participant VerificationJob
  participant NpmTarballs
  participant InstalledWrapper
  ReleaseWorkflow->>VerificationJob: start product-specific verification
  VerificationJob->>NpmTarballs: pack release packages
  VerificationJob->>NpmTarballs: compare payload files by SHA256
  VerificationJob->>InstalledWrapper: run install script and --version smoke test
  VerificationJob-->>ReleaseWorkflow: permit publishing
Loading

Possibly related PRs

  • pnpm/pnpm#11496: Both changes modify the npm package preparation and trusted publishing flow in release.yml.
  • pnpm/pnpm#12613: Both changes modify release workflow job dependencies and publishing gates.

Suggested reviewers: copilot

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/verify-rust-release-artifacts

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-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Verify packed Rust npm tarballs before publishing in release workflow

🐞 Bug fix ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Pack each generated Rust npm package and validate expected payload files pre-publish.
• Verify packed tarball bytes match on-disk artifacts and files are non-empty.
• Smoke-test Linux wrapper install path from tarballs before any npm publish.
Diagram

graph TD
  A["GitHub Actions: release.yml"] --> B["Pack npm packages"] --> C[("Packed .tgz tarballs")]
  C --> D["Verify payload: non-empty + sha256 match"] --> E["Smoke install: Linux pnpm wrapper"] --> F["Publish to npm"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Use npm/pnpm dry-run + file listing (no checksum)
  • ➕ Simpler and faster than extracting and hashing tarball contents
  • ➕ Less shell/Node glue code to maintain
  • ➖ Does not prove byte-for-byte identity of shipped binaries
  • ➖ May miss subtle packaging regressions (truncation/transform issues)
2. Move verification into a dedicated Node script
  • ➕ More readable/maintainable than inline bash+node -e
  • ➕ Easier to unit-test and reuse across workflows
  • ➖ Adds repo surface area (script + tests) for a workflow-only concern
  • ➖ Still needs careful handling of pack output and paths

Recommendation: The PR’s approach is appropriate for release safety: it verifies the exact tarballs that pnpm publish would upload, checks for missing/empty payload files, and adds a smoke test that exercises the Linux wrapper’s native-binary install path. A follow-up refactor into a small Node script could improve maintainability, but the current gate meaningfully reduces release risk with minimal moving parts.

Files changed (1) +39 / -0

Bug fix (1) +39 / -0
release.ymlAdd pre-publish tarball verification + Linux wrapper smoke test +39/-0

Add pre-publish tarball verification + Linux wrapper smoke test

• Introduces a pre-publish step that packs each generated npm package into an out-of-tree directory, then verifies declared payload files are present, non-empty, and byte-identical between the working directory and the packed tarball. Adds a smoke test that extracts the Linux native and wrapper tarballs into a temp node_modules layout, runs the wrapper install script, and confirms 'pnpm --version' succeeds before publishing.

.github/workflows/release.yml

@qodo-code-review

qodo-code-review Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Context used
✅ Compliance rules (platform): 18 rules

Grey Divider


Action required

1. Payload checks skip missing ✓ Resolved 🐞 Bug ⛨ Security
Description
The verification loops continue when a declared literal payload path is missing or is a directory,
so the gate can succeed without validating any required payload bytes (allowing broken platform
tarballs to pass). This undermines the new pre-publish integrity check because missing
executables/files won’t reliably fail the workflow.
Code

.github/workflows/release.yml[R508-516]

+              const files = [...(manifest.files ?? []), ...(manifest.publishConfig?.executableFiles ?? [])]
+              if (!files.some((file) => !/[?*[]/.test(file))) throw new Error("No literal payload files declared by " + manifest.name)
+              for (const file of files) {
+                if (!/[?*[]/.test(file)) console.log(file.replace(/^\.\//, ""))
+              }
+            ' "$package/package.json" | while IFS= read -r file; do
+              if [ ! -f "$package/$file" ]; then continue; fi
+              test -s "$package/$file"
+              test "$(tar -xOf "$tarball" "package/$file" | sha256sum | cut -d ' ' -f 1)" = "$(sha256sum "$package/$file" | cut -d ' ' -f 1)"
Evidence
The workflow currently treats any “literal” files entry as a payload candidate, but then skips it
unless it is a regular file, which allows missing payloads (and directory-only files manifests) to
pass without verification.

.github/workflows/release.yml[506-517]
.github/workflows/release.yml[185-196]
pnpm11/pnpm/package.json[48-52]
pnpm11/pnpm/artifacts/darwin-arm64/package.json[16-18]

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 new release verification logic enumerates “literal payload” entries from `package.json` (`files` + `publishConfig.executableFiles`) but then **silently skips** any entry that is not a regular file:

```bash
if [ ! -f "$package/$file" ]; then continue; fi
```

This means:
- If a declared payload file is **missing**, verification does not fail.
- If a declared literal entry is a **directory** (common in `files`), verification does not recurse, so it may verify **nothing**.

That defeats the goal of catching packlist/build regressions before the first immutable publish.

### Issue Context
This pattern appears in all three new gates (TS, Rust, pnpr). It’s especially problematic for packages whose `files` list contains directories (e.g. `dist`, `bin`) because they are treated as “literal” but then skipped.

### Fix Focus Areas
- .github/workflows/release.yml[185-196]
- .github/workflows/release.yml[506-517]
- .github/workflows/release.yml[803-815]

### Suggested fix
1. **Fail** when a declared literal payload path is missing or is not the expected type.
  - Replace `continue` with an explicit error (print package + file) and `exit 1`.
2. Don’t treat directory entries as “payload files” unless you actually validate their contents.
  - Prefer validating concrete file paths derived from:
    - `publishConfig.executableFiles`
    - `bin` targets (e.g. `bin/pnpm.mjs`, `bin/pnpx.mjs`)
    - any literal `files` entries that resolve to regular files
  - Alternatively, if you want to support directory entries in `files`, recursively enumerate regular files under those directories (with an allowlist to keep runtime bounded) and compare tarball bytes for each.
3. Keep the behavior consistent across TS/Rust/pnpr gates.

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


2. OIDC exposed to artifacts ✓ Resolved 🐞 Bug ⛨ Security
Description
The new verification step extracts and runs the packaged Rust pnpm binary (…/pnpm --version)
inside publish-rust, a job that has id-token: write for npm trusted publishing. If a release
artifact is compromised, the executed binary can request an Actions OIDC token via the runner
endpoint and potentially misuse the trusted-publishing identity within the scope of configured
packages.
Code

.github/workflows/release.yml[R446-455]

+          smoke_dir=$(mktemp -d)
+          native_tarball=$(find "$release_tarballs/pnpm_npm_pacquet-linux-x64" -type f -name '*.tgz' -print -quit)
+          wrapper_tarball=$(find "$release_tarballs/pnpm_npm_pnpm" -type f -name '*.tgz' -print -quit)
+          mkdir -p "$smoke_dir/node_modules/@pnpm/exe.linux-x64" "$smoke_dir/node_modules/pnpm"
+          tar -xzf "$native_tarball" \
+            -C "$smoke_dir/node_modules/@pnpm/exe.linux-x64" --strip-components=1
+          tar -xzf "$wrapper_tarball" \
+            -C "$smoke_dir/node_modules/pnpm" --strip-components=1
+          node "$smoke_dir/node_modules/pnpm/install.js"
+          "$smoke_dir/node_modules/pnpm/pnpm" --version
Evidence
publish-rust grants OIDC permissions, and the newly added verification step runs the packaged
pnpm binary in that same job, violating the repo’s guidance to scope workflow
credentials/permissions to the minimum necessary surface.

.github/workflows/release.yml[363-370]
.github/workflows/release.yml[418-455]
REVIEW_GUIDE.md[101-103]

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 release workflow executes a freshly built native binary during verification in a job that has `id-token: write` for trusted publishing. This increases the blast radius of any compromised build artifact because executed code can request an OIDC token from the Actions runtime endpoint.

## Issue Context
GitHub Actions does not support step-level permission narrowing; `id-token: write` applies to every step in the job. The workflow’s security guide explicitly calls for scoping secrets/permissions to the exact step/job that needs them.

## Fix Focus Areas
- .github/workflows/release.yml[363-472]

### Concrete fix direction
- Split `publish-rust` into two jobs:
 1) `verify-rust-artifacts` (no `id-token: write`, ideally `permissions: {}`) that runs **Generate npm packages** + **Verify generated npm packages**.
 2) `publish-rust` that depends on `verify-rust-artifacts` and contains only the publish step(s) requiring OIDC.
- Keep artifact download/extract in the verify job if needed, then either:
 - regenerate packages in the publish job again (cheap, avoids artifact-passing complexity), or
 - upload the verified tarballs as an intermediate artifact and publish from that verified output.

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



Remediation recommended

3. O(n²) tarball hashing 🐞 Bug ➹ Performance ⭐ New
Description
The verifier recursively expands directory entries from package manifests (e.g. "dist"/"bin") into
every file and emits them for later per-file tar extraction + hashing, which scales poorly for
packages that include large directory trees. This can materially slow release verification,
especially for bundles like @pnpm/exe that include a dist/ tree with node_modules content.
Code

.github/workflows/release.yml[R194-213]

+              for (const file of manifest.files ?? []) {
+                if (!file.startsWith("!") && !/[?*[]/.test(file)) add(file)
+              }
+              for (const file of manifest.publishConfig?.executableFiles ?? []) add(file)
+              for (const file of Object.values(typeof manifest.bin === "string" ? { default: manifest.bin } : manifest.bin ?? {})) add(file)
+              if (files.size === 0) throw new Error("No literal payload files declared by " + manifest.name)
+              console.log([...files].join("\n"))
+
+              function add(file) {
+                const relative = file.replace(/^\.\//, "")
+                if (excluded.some((pattern) => pattern.test(relative))) return
+                const source = path.join(packageDir, relative)
+                const stat = fs.statSync(source, { throwIfNoEntry: false })
+                if (stat?.isFile()) {
+                  files.add(relative)
+                  return
+                }
+                if (!stat?.isDirectory()) throw new Error("Missing payload file " + source)
+                for (const entry of fs.readdirSync(source, { withFileTypes: true })) add(path.join(relative, entry.name))
+              }
Evidence
The verifier adds non-glob files entries and recursively walks directories, which means directory
roots like dist/dist/ cause enumeration of entire trees. Several release package manifests
include directory roots (pnpm uses dist/bin; @pnpm/exe includes dist/ and references
executable files under dist/node_modules), so the verifier’s recursion can generate a large file
list that later drives per-file tar reads/hashing.

.github/workflows/release.yml[186-213]
.github/workflows/release.yml[218-221]
pnpm11/pnpm/package.json[48-58]
pnpm11/pnpm/artifacts/exe/package.json[18-76]

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’s inline verifier treats directory entries in `package.json` as payload roots and recursively enumerates every file under them, which then drives a later per-file `tar -xOf … | sha256` comparison. This can become very expensive for packages whose `files` includes directories like `dist/`.

### Issue Context
This is in the new verification gate that runs before publishing. The intent is integrity checking, but the current approach can create a large per-file loop and repeatedly re-scan the tarball.

### Fix Focus Areas
- .github/workflows/release.yml[194-213]

### Suggested fix
Refactor the verification to avoid per-file `tar -xOf` reads:
- Extract the tarball once to a temp directory and compare hashes using a single filesystem walk, or
- Use a single-pass tar listing/extraction in Node to compute hashes for all relevant entries, or
- Limit hashing to a small explicit set of “payload binaries” instead of expanding directory roots (if full-directory verification isn’t required).

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


4. Unsafe artifact extraction 🐞 Bug ⛨ Security
Description
verify-pnpr-artifacts unzips and untars downloaded build artifacts directly into the job workspace
without validating member paths, so a compromised artifact can overwrite files under
$GITHUB_WORKSPACE that are executed later in the job (e.g. generate-packages.mjs). The same
unconstrained extraction pattern is also present in the OIDC-enabled publish-pnpr job, which
increases impact if an artifact were ever attacker-controlled.
Code

.github/workflows/release.yml[R863-870]

+        run: |
+          for archive in ./*.gz; do
+            tar xf "$archive"
+          done

      - name: Generate npm packages
-        run: |
-          node pnpr/npm/pnpr/scripts/generate-packages.mjs
-          cat pnpr/npm/pnpr/package.json
-          for package in pnpr/npm/pnpr*; do cat $package/package.json ; echo ; done
+        run: node pnpr/npm/pnpr/scripts/generate-packages.mjs
Evidence
The workflow currently extracts archives into the workspace and then executes repo scripts; this
creates an overwrite-and-execute path if artifacts are ever compromised. The build step shows the
archives are intended to contain only the renamed binary, so extraction can be safely constrained.
REVIEW_GUIDE.md requires treating archives as attacker-controlled and tightening CI boundaries.

.github/workflows/release.yml[862-870]
.github/workflows/release.yml[745-786]
.github/workflows/release.yml[710-727]
REVIEW_GUIDE.md[101-103]

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 extracts downloaded `.zip` / `.tar.gz` artifacts into the repository workspace (`-d .` / `tar xf` with no destination/sanity checks). If an artifact contains unexpected member paths (e.g. `../` segments, collisions, or symlink/hardlink tricks), extraction can overwrite workspace files. Since the workflow runs `node pnpr/npm/pnpr/scripts/generate-packages.mjs` after extraction, a compromised artifact could alter code that is subsequently executed.

## Issue Context
- `build-pnpr` produces archives that are intended to contain just the renamed binary at the archive root (plus a `.sha256` alongside it), so the extraction can be safely constrained to a temp dir and then only the expected file(s) moved out.
- REVIEW_GUIDE.md explicitly calls out CI/workflow changes should treat archives as attacker-controlled and scope privileges/secrets tightly.

## Fix Focus Areas
- .github/workflows/release.yml[770-786]
- .github/workflows/release.yml[862-870]
- .github/workflows/release.yml[710-727]

## Suggested fix approach
1. Replace `unzip -qq *.zip -d .` with per-archive extraction into a fresh temp dir (or `extract/`) and move only `pnpr-*.exe` out.
2. Replace `tar xf "$archive"` with `tar -xzf "$archive" -C "$tmp"` and then move only the expected `pnpr-*` file out.
3. Optionally, before extracting, list members (`tar -tf`, `unzip -Z1`) and fail if any entry is absolute, contains `..`, or is not in an allowlist.
4. Keep extracted artifacts out of the repo checkout directory to avoid collisions/overwrites.

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


5. Duplicated tarball verification logic 📘 Rule violation ⚙ Maintainability
Description
The workflow repeats the same inline node -e + shell loop logic for discovering literal payload
files and validating tarball contents across multiple jobs. This duplication increases the risk of
future drift (inconsistent behavior/bug fixes) and violates the requirement to extract and reuse
shared modules for existing functionality.
Code

.github/workflows/release.yml[R185-196]

+            node -e '
+              const manifest = require(require("node:path").resolve(process.argv[1]))
+              const files = [...(manifest.files ?? []), ...(manifest.publishConfig?.executableFiles ?? [])]
+              if (!files.some((file) => !/[?*[]/.test(file))) throw new Error("No literal payload files declared by " + manifest.name)
+              for (const file of files) {
+                if (!/[?*[]/.test(file)) console.log(file.replace(/^\.\//, ""))
+              }
+            ' "$package/package.json" | while IFS= read -r file; do
+              if [ ! -f "$package/$file" ]; then continue; fi
+              test -s "$package/$file"
+              test "$(tar -xOf "$tarball" "package/$file" | shasum -a 256 | cut -d ' ' -f 1)" = "$(shasum -a 256 "$package/$file" | cut -d ' ' -f 1)"
+            done
Evidence
PR Compliance ID 713439 requires avoiding reimplementation/duplication by extracting and reusing
shared modules. The same inline Node script and surrounding loop structure is repeated in three
workflow jobs, indicating duplicated functionality that should be centralized to prevent drift.

Rule 713439: Avoid reimplementing existing functionality; extract and reuse shared modules
.github/workflows/release.yml[185-196]
.github/workflows/release.yml[506-517]
.github/workflows/release.yml[803-815]

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 release workflow duplicates the tarball verification logic (manifest `files` discovery + per-file hash/emptiness validation) in multiple jobs.

## Issue Context
This logic appears in the TypeScript verification job, the Rust artifacts verification job, and the pnpr artifacts verification job, with only small platform-specific differences. Keeping this as repeated inline scripts makes it easy for one path to diverge (security/correctness fixes applied in one job but not the others).

## Fix Focus Areas
- .github/workflows/release.yml[185-196]
- .github/workflows/release.yml[506-517]
- .github/workflows/release.yml[803-815]

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


View more (1)
6. Missing tarball assertions ✓ Resolved 🐞 Bug ☼ Reliability
Description
The smoke-test paths native_tarball and wrapper_tarball are not checked for non-empty/existence
before tar -xzf, so a missing tarball fails with a less actionable tar error instead of a clear
“expected tarball not found” message. This makes release failures harder to diagnose even though
set -euo pipefail will still fail the step.
Code

.github/workflows/release.yml[R446-453]

+          smoke_dir=$(mktemp -d)
+          native_tarball=$(find "$release_tarballs/pnpm_npm_pacquet-linux-x64" -type f -name '*.tgz' -print -quit)
+          wrapper_tarball=$(find "$release_tarballs/pnpm_npm_pnpm" -type f -name '*.tgz' -print -quit)
+          mkdir -p "$smoke_dir/node_modules/@pnpm/exe.linux-x64" "$smoke_dir/node_modules/pnpm"
+          tar -xzf "$native_tarball" \
+            -C "$smoke_dir/node_modules/@pnpm/exe.linux-x64" --strip-components=1
+          tar -xzf "$wrapper_tarball" \
+            -C "$smoke_dir/node_modules/pnpm" --strip-components=1
Evidence
The smoke test assigns tarball paths via find and immediately uses them with tar -xzf without
validating they exist, unlike the per-package tarball check earlier in the same step.

.github/workflows/release.yml[446-453]
.github/workflows/release.yml[433-435]

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 smoke test uses `native_tarball`/`wrapper_tarball` from `find ... -print -quit` without asserting they are present before passing them to `tar -xzf`, which produces cryptic failures when expected tarballs are missing.

## Issue Context
The earlier loop does `test -n "$tarball"`, but the smoke-test tarballs don’t get the same guard.

## Fix Focus Areas
- .github/workflows/release.yml[446-455]

### Concrete fix direction
Add explicit checks (and ideally clearer messages), e.g.:
- `test -n "$native_tarball" && test -f "$native_tarball"`
- `test -n "$wrapper_tarball" && test -f "$wrapper_tarball"`
Optionally emit `ls -R "$release_tarballs"` on failure to aid debugging.

ⓘ 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 8c81259

Results up to commit 66bd3e4


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. OIDC exposed to artifacts ✓ Resolved 🐞 Bug ⛨ Security
Description
The new verification step extracts and runs the packaged Rust pnpm binary (…/pnpm --version)
inside publish-rust, a job that has id-token: write for npm trusted publishing. If a release
artifact is compromised, the executed binary can request an Actions OIDC token via the runner
endpoint and potentially misuse the trusted-publishing identity within the scope of configured
packages.
Code

.github/workflows/release.yml[R446-455]

+          smoke_dir=$(mktemp -d)
+          native_tarball=$(find "$release_tarballs/pnpm_npm_pacquet-linux-x64" -type f -name '*.tgz' -print -quit)
+          wrapper_tarball=$(find "$release_tarballs/pnpm_npm_pnpm" -type f -name '*.tgz' -print -quit)
+          mkdir -p "$smoke_dir/node_modules/@pnpm/exe.linux-x64" "$smoke_dir/node_modules/pnpm"
+          tar -xzf "$native_tarball" \
+            -C "$smoke_dir/node_modules/@pnpm/exe.linux-x64" --strip-components=1
+          tar -xzf "$wrapper_tarball" \
+            -C "$smoke_dir/node_modules/pnpm" --strip-components=1
+          node "$smoke_dir/node_modules/pnpm/install.js"
+          "$smoke_dir/node_modules/pnpm/pnpm" --version
Evidence
publish-rust grants OIDC permissions, and the newly added verification step runs the packaged
pnpm binary in that same job, violating the repo’s guidance to scope workflow
credentials/permissions to the minimum necessary surface.

.github/workflows/release.yml[363-370]
.github/workflows/release.yml[418-455]
REVIEW_GUIDE.md[101-103]

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 release workflow executes a freshly built native binary during verification in a job that has `id-token: write` for trusted publishing. This increases the blast radius of any compromised build artifact because executed code can request an OIDC token from the Actions runtime endpoint.

## Issue Context
GitHub Actions does not support step-level permission narrowing; `id-token: write` applies to every step in the job. The workflow’s security guide explicitly calls for scoping secrets/permissions to the exact step/job that needs them.

## Fix Focus Areas
- .github/workflows/release.yml[363-472]

### Concrete fix direction
- Split `publish-rust` into two jobs:
 1) `verify-rust-artifacts` (no `id-token: write`, ideally `permissions: {}`) that runs **Generate npm packages** + **Verify generated npm packages**.
 2) `publish-rust` that depends on `verify-rust-artifacts` and contains only the publish step(s) requiring OIDC.
- Keep artifact download/extract in the verify job if needed, then either:
 - regenerate packages in the publish job again (cheap, avoids artifact-passing complexity), or
 - upload the verified tarballs as an intermediate artifact and publish from that verified output.

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



Remediation recommended
2. Missing tarball assertions ✓ Resolved 🐞 Bug ☼ Reliability
Description
The smoke-test paths native_tarball and wrapper_tarball are not checked for non-empty/existence
before tar -xzf, so a missing tarball fails with a less actionable tar error instead of a clear
“expected tarball not found” message. This makes release failures harder to diagnose even though
set -euo pipefail will still fail the step.
Code

.github/workflows/release.yml[R446-453]

+          smoke_dir=$(mktemp -d)
+          native_tarball=$(find "$release_tarballs/pnpm_npm_pacquet-linux-x64" -type f -name '*.tgz' -print -quit)
+          wrapper_tarball=$(find "$release_tarballs/pnpm_npm_pnpm" -type f -name '*.tgz' -print -quit)
+          mkdir -p "$smoke_dir/node_modules/@pnpm/exe.linux-x64" "$smoke_dir/node_modules/pnpm"
+          tar -xzf "$native_tarball" \
+            -C "$smoke_dir/node_modules/@pnpm/exe.linux-x64" --strip-components=1
+          tar -xzf "$wrapper_tarball" \
+            -C "$smoke_dir/node_modules/pnpm" --strip-components=1
Evidence
The smoke test assigns tarball paths via find and immediately uses them with tar -xzf without
validating they exist, unlike the per-package tarball check earlier in the same step.

.github/workflows/release.yml[446-453]
.github/workflows/release.yml[433-435]

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 smoke test uses `native_tarball`/`wrapper_tarball` from `find ... -print -quit` without asserting they are present before passing them to `tar -xzf`, which produces cryptic failures when expected tarballs are missing.

## Issue Context
The earlier loop does `test -n "$tarball"`, but the smoke-test tarballs don’t get the same guard.

## Fix Focus Areas
- .github/workflows/release.yml[446-455]

### Concrete fix direction
Add explicit checks (and ideally clearer messages), e.g.:
- `test -n "$native_tarball" && test -f "$native_tarball"`
- `test -n "$wrapper_tarball" && test -f "$wrapper_tarball"`
Optionally emit `ls -R "$release_tarballs"` on failure to aid debugging.

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


Results up to commit dc1e99c


🐞 Bugs (0) 📘 Rule violations (1) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. Payload checks skip missing ✓ Resolved 🐞 Bug ⛨ Security
Description
The verification loops continue when a declared literal payload path is missing or is a directory,
so the gate can succeed without validating any required payload bytes (allowing broken platform
tarballs to pass). This undermines the new pre-publish integrity check because missing
executables/files won’t reliably fail the workflow.
Code

.github/workflows/release.yml[R508-516]

+              const files = [...(manifest.files ?? []), ...(manifest.publishConfig?.executableFiles ?? [])]
+              if (!files.some((file) => !/[?*[]/.test(file))) throw new Error("No literal payload files declared by " + manifest.name)
+              for (const file of files) {
+                if (!/[?*[]/.test(file)) console.log(file.replace(/^\.\//, ""))
+              }
+            ' "$package/package.json" | while IFS= read -r file; do
+              if [ ! -f "$package/$file" ]; then continue; fi
+              test -s "$package/$file"
+              test "$(tar -xOf "$tarball" "package/$file" | sha256sum | cut -d ' ' -f 1)" = "$(sha256sum "$package/$file" | cut -d ' ' -f 1)"
Evidence
The workflow currently treats any “literal” files entry as a payload candidate, but then skips it
unless it is a regular file, which allows missing payloads (and directory-only files manifests) to
pass without verification.

.github/workflows/release.yml[506-517]
.github/workflows/release.yml[185-196]
pnpm11/pnpm/package.json[48-52]
pnpm11/pnpm/artifacts/darwin-arm64/package.json[16-18]

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 new release verification logic enumerates “literal payload” entries from `package.json` (`files` + `publishConfig.executableFiles`) but then **silently skips** any entry that is not a regular file:

```bash
if [ ! -f "$package/$file" ]; then continue; fi
```

This means:
- If a declared payload file is **missing**, verification does not fail.
- If a declared literal entry is a **directory** (common in `files`), verification does not recurse, so it may verify **nothing**.

That defeats the goal of catching packlist/build regressions before the first immutable publish.

### Issue Context
This pattern appears in all three new gates (TS, Rust, pnpr). It’s especially problematic for packages whose `files` list contains directories (e.g. `dist`, `bin`) because they are treated as “literal” but then skipped.

### Fix Focus Areas
- .github/workflows/release.yml[185-196]
- .github/workflows/release.yml[506-517]
- .github/workflows/release.yml[803-815]

### Suggested fix
1. **Fail** when a declared literal payload path is missing or is not the expected type.
  - Replace `continue` with an explicit error (print package + file) and `exit 1`.
2. Don’t treat directory entries as “payload files” unless you actually validate their contents.
  - Prefer validating concrete file paths derived from:
    - `publishConfig.executableFiles`
    - `bin` targets (e.g. `bin/pnpm.mjs`, `bin/pnpx.mjs`)
    - any literal `files` entries that resolve to regular files
  - Alternatively, if you want to support directory entries in `files`, recursively enumerate regular files under those directories (with an allowlist to keep runtime bounded) and compare tarball bytes for each.
3. Keep the behavior consistent across TS/Rust/pnpr gates.

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



Remediation recommended
2. Duplicated tarball verification logic 📘 Rule violation ⚙ Maintainability
Description
The workflow repeats the same inline node -e + shell loop logic for discovering literal payload
files and validating tarball contents across multiple jobs. This duplication increases the risk of
future drift (inconsistent behavior/bug fixes) and violates the requirement to extract and reuse
shared modules for existing functionality.
Code

.github/workflows/release.yml[R185-196]

+            node -e '
+              const manifest = require(require("node:path").resolve(process.argv[1]))
+              const files = [...(manifest.files ?? []), ...(manifest.publishConfig?.executableFiles ?? [])]
+              if (!files.some((file) => !/[?*[]/.test(file))) throw new Error("No literal payload files declared by " + manifest.name)
+              for (const file of files) {
+                if (!/[?*[]/.test(file)) console.log(file.replace(/^\.\//, ""))
+              }
+            ' "$package/package.json" | while IFS= read -r file; do
+              if [ ! -f "$package/$file" ]; then continue; fi
+              test -s "$package/$file"
+              test "$(tar -xOf "$tarball" "package/$file" | shasum -a 256 | cut -d ' ' -f 1)" = "$(shasum -a 256 "$package/$file" | cut -d ' ' -f 1)"
+            done
Evidence
PR Compliance ID 713439 requires avoiding reimplementation/duplication by extracting and reusing
shared modules. The same inline Node script and surrounding loop structure is repeated in three
workflow jobs, indicating duplicated functionality that should be centralized to prevent drift.

Rule 713439: Avoid reimplementing existing functionality; extract and reuse shared modules
.github/workflows/release.yml[185-196]
.github/workflows/release.yml[506-517]
.github/workflows/release.yml[803-815]

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 release workflow duplicates the tarball verification logic (manifest `files` discovery + per-file hash/emptiness validation) in multiple jobs.

## Issue Context
This logic appears in the TypeScript verification job, the Rust artifacts verification job, and the pnpr artifacts verification job, with only small platform-specific differences. Keeping this as repeated inline scripts makes it easy for one path to diverge (security/correctness fixes applied in one job but not the others).

## Fix Focus Areas
- .github/workflows/release.yml[185-196]
- .github/workflows/release.yml[506-517]
- .github/workflows/release.yml[803-815]

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


Results up to commit 7f36ae1


🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. Unsafe artifact extraction 🐞 Bug ⛨ Security
Description
verify-pnpr-artifacts unzips and untars downloaded build artifacts directly into the job workspace
without validating member paths, so a compromised artifact can overwrite files under
$GITHUB_WORKSPACE that are executed later in the job (e.g. generate-packages.mjs). The same
unconstrained extraction pattern is also present in the OIDC-enabled publish-pnpr job, which
increases impact if an artifact were ever attacker-controlled.
Code

.github/workflows/release.yml[R863-870]

+        run: |
+          for archive in ./*.gz; do
+            tar xf "$archive"
+          done

      - name: Generate npm packages
-        run: |
-          node pnpr/npm/pnpr/scripts/generate-packages.mjs
-          cat pnpr/npm/pnpr/package.json
-          for package in pnpr/npm/pnpr*; do cat $package/package.json ; echo ; done
+        run: node pnpr/npm/pnpr/scripts/generate-packages.mjs
Evidence
The workflow currently extracts archives into the workspace and then executes repo scripts; this
creates an overwrite-and-execute path if artifacts are ever compromised. The build step shows the
archives are intended to contain only the renamed binary, so extraction can be safely constrained.
REVIEW_GUIDE.md requires treating archives as attacker-controlled and tightening CI boundaries.

.github/workflows/release.yml[862-870]
.github/workflows/release.yml[745-786]
.github/workflows/release.yml[710-727]
REVIEW_GUIDE.md[101-103]

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 extracts downloaded `.zip` / `.tar.gz` artifacts into the repository workspace (`-d .` / `tar xf` with no destination/sanity checks). If an artifact contains unexpected member paths (e.g. `../` segments, collisions, or symlink/hardlink tricks), extraction can overwrite workspace files. Since the workflow runs `node pnpr/npm/pnpr/scripts/generate-packages.mjs` after extraction, a compromised artifact could alter code that is subsequently executed.

## Issue Context
- `build-pnpr` produces archives that are intended to contain just the renamed binary at the archive root (plus a `.sha256` alongside it), so the extraction can be safely constrained to a temp dir and then only the expected file(s) moved out.
- REVIEW_GUIDE.md explicitly calls out CI/workflow changes should treat archives as attacker-controlled and scope privileges/secrets tightly.

## Fix Focus Areas
- .github/workflows/release.yml[770-786]
- .github/workflows/release.yml[862-870]
- .github/workflows/release.yml[710-727]

## Suggested fix approach
1. Replace `unzip -qq *.zip -d .` with per-archive extraction into a fresh temp dir (or `extract/`) and move only `pnpr-*.exe` out.
2. Replace `tar xf "$archive"` with `tar -xzf "$archive" -C "$tmp"` and then move only the expected `pnpr-*` file out.
3. Optionally, before extracting, list members (`tar -tf`, `unzip -Z1`) and fail if any entry is absolute, contains `..`, or is not in an allowlist.
4. Keep extracted artifacts out of the repo checkout directory to avoid collisions/overwrites.

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


Qodo Logo

Comment thread .github/workflows/release.yml Resolved

@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/release.yml:
- Around line 440-443: Update the manifest.files validation loop in the release
workflow to process only regular files, not directories. Add a file-type check
before invoking tar and checksum validation, while preserving the existing
checks for listed files.
🪄 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: 2d46b8b0-9d03-45f0-89f6-09327a9b43fe

📥 Commits

Reviewing files that changed from the base of the PR and between d768a84 and 66bd3e4.

📒 Files selected for processing (1)
  • .github/workflows/release.yml

Comment thread .github/workflows/release.yml Resolved
@greptile-apps

greptile-apps Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge — the new verify jobs are read-only (no write permissions, no OIDC token), all publish jobs still run in their existing environment-gated contexts, and the skip-cascade for conditional releases (Rust, pnpr) is correct.

The changes add defensive verification gates before publishing and make no functional changes to the publish steps themselves. All previously flagged issues have been resolved: smoke-test tarballs are guarded with test -n, the zero-iteration loop now throws on empty manifests, and absent declared payload files now cause a hard failure. The job structure is correct and the security boundary between verification and OIDC-enabled publishing is preserved.

No files require special attention.

Reviews (3): Last reviewed commit: "fix(release): verify declared package pa..." | Re-trigger Greptile

Comment thread .github/workflows/release.yml Resolved
Comment thread .github/workflows/release.yml Resolved
@qodo-code-review

qodo-code-review Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to 8c81259

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

CategorySuggestion                                                                                                                                    Impact
Security
Publish the verified artifacts

Pass the tarballs verified in verify-ts-release to the release job via artifacts
instead of rebuilding them. This ensures exactly what was tested is what gets
published.

.github/workflows/release.yml [167-273]

-- name: Build TypeScript executable artifacts
-  run: pn --filter=@pnpm/exe run build-artifacts
+- name: Build and verify TypeScript npm packages
+  run: |
+    pn --filter=@pnpm/exe run build-artifacts
+    mkdir release-tarballs
+    ...
+    pn pack --pack-destination "$GITHUB_WORKSPACE/release-tarballs"
+    ...
 
-- name: Verify TypeScript npm packages
-  run: |
-    ...
-    pn pack --pack-destination "$package_tarballs"
-    ...
+- name: Upload verified TypeScript tarballs
+  uses: actions/upload-artifact@v4
+  with:
+    name: verified-ts-release-tarballs
+    path: release-tarballs/*.tgz
+    if-no-files-found: error
 
 ...
 
-- name: Build TypeScript executable artifacts
-  run: pn --filter=@pnpm/exe run build-artifacts
+- name: Download verified TypeScript tarballs
+  uses: actions/download-artifact@v4
+  with:
+    name: verified-ts-release-tarballs
+    path: release-tarballs
 
+- name: Publish verified tarballs
+  run: |
+    for tarball in release-tarballs/*.tgz; do
+      pn publish "$tarball" --tag=next-11 --access=public --provenance
+    done
+

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 8

__

Why: Rebuilding artifacts in the release job introduces a time-of-check/time-of-use (TOCTOU) vulnerability; passing the verified tarballs between jobs ensures the published artifacts are exactly the ones that were tested.

Medium
Possible issue
Verify every published package

Dynamically generate the list of packages to verify to include internal
workspace packages as well, preventing unverified packages from being published.

.github/workflows/release.yml [176]

-for package in pnpm11/pnpm/artifacts/{darwin-arm64,exe,linux-arm64,linux-arm64-musl,linux-x64,linux-x64-musl,win32-arm64,win32-x64} pnpm11/pnpm; do
+mapfile -t packages < <(
+  pn --filter '<the same selector used by Publish internal workspace packages>' list \
+    --depth=-1 --json |
+    node scripts/print-package-directories.mjs
+)
+packages+=(
+  pnpm11/pnpm/artifacts/darwin-arm64
+  pnpm11/pnpm/artifacts/exe
+  pnpm11/pnpm/artifacts/linux-arm64
+  pnpm11/pnpm/artifacts/linux-arm64-musl
+  pnpm11/pnpm/artifacts/linux-x64
+  pnpm11/pnpm/artifacts/linux-x64-musl
+  pnpm11/pnpm/artifacts/win32-arm64
+  pnpm11/pnpm/artifacts/win32-x64
+  pnpm11/pnpm
+)
+for package in "${packages[@]}"; do
+  ...
+done

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 4

__

Why: While dynamically verifying all published packages is a more robust approach, the hardcoded list intentionally targets the CLI and executable platform packages which contain complex bundling logic, making this a lower-priority improvement.

Low
  • More

Previous suggestions

Suggestions up to commit 7f36ae1
CategorySuggestion                                                                                                                                    Impact
Security
Publish the exact verified artifacts

Do not rebuild artifacts in the release job after they have been verified.
Instead, upload the verified tarballs from the verification job and download
them in the publish job to ensure exactly the same files are published.

.github/workflows/release.yml [248-249]

-- name: Build TypeScript executable artifacts
-  run: pn --filter=@pnpm/exe run build-artifacts
+- name: Download verified TypeScript npm tarballs
+  uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+  with:
+    name: verified-ts-release-tarballs
+    path: release-tarballs
Suggestion importance[1-10]: 9

__

Why: Rebuilding artifacts after verifying them defeats the purpose of the verification, as non-deterministic builds or compromised build environments could lead to publishing unverified, malicious payloads.

High
Possible issue
Reject missing declared package payloads

Do not skip missing payload paths or directories silently. Fail if paths are
missing and recursively verify the contents of directories to ensure complete
validation.

.github/workflows/release.yml [194-196]

-if [ ! -f "$package/$file" ]; then continue; fi
-test -s "$package/$file"
-test "$(tar -xOf "$tarball" "package/$file" | shasum -a 256 | cut -d ' ' -f 1)" = "$(shasum -a 256 "$package/$file" | cut -d ' ' -f 1)"
+test -e "$package/$file"
+if [ -d "$package/$file" ]; then
+  find "$package/$file" -type f -print0
+else
+  printf '%s\0' "$package/$file"
+fi | while IFS= read -r -d '' payload; do
+  relative_payload=${payload#"$package/"}
+  test -s "$payload"
+  test "$(tar -xOf "$tarball" "package/$relative_payload" | shasum -a 256 | cut -d ' ' -f 1)" = "$(shasum -a 256 "$payload" | cut -d ' ' -f 1)"
+done
Suggestion importance[1-10]: 8

__

Why: Silently ignoring directories and missing files bypasses the verification logic for those entries, potentially leading to incomplete or flawed payload verification.

Medium
Suggestions up to commit dc1e99c
CategorySuggestion                                                                                                                                    Impact
Possible issue
Reject missing declared package payloads

Fail the verification step if a declared file is missing from the package
directory. Apply this fix to the TypeScript, Rust, and pnpr verification loops.

.github/workflows/release.yml [185-196]

 node -e '
   const manifest = require(require("node:path").resolve(process.argv[1]))
   const files = [...(manifest.files ?? []), ...(manifest.publishConfig?.executableFiles ?? [])]
   if (!files.some((file) => !/[?*[]/.test(file))) throw new Error("No literal payload files declared by " + manifest.name)
   for (const file of files) {
     if (!/[?*[]/.test(file)) console.log(file.replace(/^\.\//, ""))
   }
 ' "$package/package.json" | while IFS= read -r file; do
-  if [ ! -f "$package/$file" ]; then continue; fi
+  test -f "$package/$file"
   test -s "$package/$file"
   test "$(tar -xOf "$tarball" "package/$file" | shasum -a 256 | cut -d ' ' -f 1)" = "$(shasum -a 256 "$package/$file" | cut -d ' ' -f 1)"
 done
Suggestion importance[1-10]: 9

__

Why: Silently skipping missing files defeats the purpose of the verification script, making this a critical fix to ensure missing binaries correctly fail the pipeline.

High
Publish the exact verified tarballs

Upload the verified tarballs as workflow artifacts and publish them directly in
the release jobs instead of rebuilding. Apply this pattern to all verification
and publishing steps.

.github/workflows/release.yml [166-254]

-- name: Build TypeScript executable artifacts
-  run: pn --filter=@pnpm/exe run build-artifacts
+- name: Build and pack TypeScript release artifacts
+  run: |
+    pn --filter=@pnpm/exe run build-artifacts
+    ...
+    pn pack --pack-destination "$release_tarballs"
 
-- name: Verify TypeScript npm packages
-  run: |
-    ...
-    pn pack --pack-destination "$package_tarballs"
-    ...
+- name: Upload verified npm tarballs
+  uses: actions/upload-artifact@...
+  with:
+    name: verified-ts-release-tarballs
+    path: ${{ env.RELEASE_TARBALLS }}/*.tgz
 
 ...
 
-- name: Build TypeScript executable artifacts
-  run: pn --filter=@pnpm/exe run build-artifacts
+- name: Download verified npm tarballs
+  uses: actions/download-artifact@...
+  with:
+    name: verified-ts-release-tarballs
+    path: release-tarballs
 
-- name: Publish @pnpm/exe (trusted publishing)
+- name: Publish verified npm tarballs
   run: |
-    pn --filter=@pnpm/exe publish --tag=next-11 --access=public --provenance
+    for tarball in release-tarballs/*.tgz; do
+      pn publish "$tarball" --tag=next-11 --access=public --provenance
+    done
Suggestion importance[1-10]: 6

__

Why: Publishing the exact artifacts that were verified guarantees correctness and prevents discrepancies, though it requires significant structural changes to the workflow's artifact passing.

Low
Suggestions up to commit bdf7bb3
CategorySuggestion                                                                                                                                    Impact
Possible issue
Reject missing manifest files

Fail the verification if any explicitly listed file in the manifest is missing,
instead of silently skipping it. Ensure that required binaries are actually
present before approving the release.

.github/workflows/release.yml [799-808]

 node -e '
   const manifest = require(require("node:path").resolve(process.argv[1]))
   for (const file of [...(manifest.files ?? []), ...(manifest.publishConfig?.executableFiles ?? [])]) {
     if (!/[?*[]/.test(file)) console.log(file.replace(/^\.\//, ""))
   }
 ' "$package/package.json" | while IFS= read -r file; do
-  if [ ! -f "$package/$file" ]; then continue; fi
+  test -f "$package/$file"
   test -s "$package/$file"
   test "$(tar -xOf "$tarball" "package/$file" | sha256sum | cut -d ' ' -f 1)" = "$(sha256sum "$package/$file" | cut -d ' ' -f 1)"
 done
Suggestion importance[1-10]: 9

__

Why: Identifies a major logical flaw in the verification script where missing files are silently ignored, completely defeating the purpose of checking for incomplete releases.

High
Security
Publish only verified tarballs

Upload the verified tarballs as artifacts and publish them directly, rather than
rebuilding them during the publish phase. This prevents discrepancies between
what is verified and what is released.

.github/workflows/release.yml [169-246]

 - name: Verify TypeScript npm packages
   run: |
     ...
     pn pack --pack-destination "$package_tarballs"
     ...
 
-- name: Build TypeScript executable artifacts
-  run: pn --filter=@pnpm/exe run build-artifacts
+- name: Upload verified TypeScript tarballs
+  uses: actions/upload-artifact@v4
+  with:
+    name: verified-ts-release-tarballs
+    path: ${{ runner.temp }}/release-tarballs/*.tgz
+    if-no-files-found: error
 
+...
+
+- name: Download verified TypeScript tarballs
+  uses: actions/download-artifact@v4
+  with:
+    name: verified-ts-release-tarballs
+    path: verified-release-tarballs
+
+- name: Publish verified npm tarballs
+  run: |
+    for tarball in verified-release-tarballs/*.tgz; do
+      pnpm publish "$tarball" --tag=next-11 --access=public --provenance
+    done
+
Suggestion importance[1-10]: 8

__

Why: Highlights a critical Time-of-Check to Time-of-Use (TOCTOU) vulnerability where the artifacts verified might differ from those ultimately published due to rebuilding.

Medium
✅ Suggestions up to commit 66bd3e4
CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix incorrect Node.js process.argv index

Update the process.argv index to 2 to correctly reference the passed
package.json path.

.github/workflows/release.yml [435-437]

 node -e '
-  const manifest = require(require("node:path").resolve(process.argv[1]))
+  const manifest = require(require("node:path").resolve(process.argv[2]))
   for (const file of [...(manifest.files ?? []), ...(manifest.publishConfig?.executableFiles ?? [])]) {
Suggestion importance[1-10]: 9

__

Why: Correctly identifies a critical bug where process.argv[1] in a node -e inline script evaluates to '[eval]', making process.argv[2] the correct index for the first argument.

High
✅ Skip directories to prevent tar/sha256sum crashes
Suggestion Impact:Added the proposed regular-file guard before tar and checksum validation, preventing directory entries from causing failures.

code diff:

             ' "$package/package.json" | while IFS= read -r file; do
+              if [ ! -f "$package/$file" ]; then continue; fi
               test -s "$package/$file"
               test "$(tar -xOf "$tarball" "package/$file" | sha256sum | cut -d ' ' -f 1)" = "$(sha256sum "$package/$file" | cut -d ' ' -f 1)"

Add a check to skip directories and only process regular files in the validation
loop.

.github/workflows/release.yml [440-443]

 ' "$package/package.json" | while IFS= read -r file; do
+  [ -f "$package/$file" ] || continue
   test -s "$package/$file"
   test "$(tar -xOf "$tarball" "package/$file" | sha256sum | cut -d ' ' -f 1)" = "$(sha256sum "$package/$file" | cut -d ' ' -f 1)"
 done

[Suggestion processed]

Suggestion importance[1-10]: 7

__

Why: Correctly identifies that manifest.files may contain directories, which would cause tar and sha256sum to fail and crash the workflow.

Medium

@zkochan zkochan changed the title fix(release): verify generated Rust package tarballs fix(release): verify all npm release tarballs Jul 15, 2026
Copilot AI review requested due to automatic review settings July 15, 2026 18:49

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.

Copilot AI review requested due to automatic review settings July 15, 2026 18:51

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.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 15, 2026
Comment thread .github/workflows/release.yml Resolved
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit dc1e99c

Copilot AI review requested due to automatic review settings July 15, 2026 18:59
@zkochan
zkochan force-pushed the fix/verify-rust-release-artifacts branch from dc1e99c to 7f36ae1 Compare July 15, 2026 18:59

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.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 7f36ae1

Comment thread .github/workflows/release.yml Resolved
Copilot AI review requested due to automatic review settings July 15, 2026 19:07

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.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 8c81259

@zkochan
zkochan merged commit 124f2a5 into main Jul 15, 2026
26 of 27 checks passed
@zkochan
zkochan deleted the fix/verify-rust-release-artifacts branch July 15, 2026 19:12

@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.

🧹 Nitpick comments (1)
.github/workflows/release.yml (1)

170-198: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the duplicated pack+hash verification loop into one shared script. The same manifest-parsing + payload-hash-comparison logic (only the hash tool differs by OS) is copy-pasted into all three new verify jobs; keeping it in one place removes the risk of the checks drifting apart as the workflow evolves.

  • .github/workflows/release.yml#L170-L198: replace this inline block with a call to a shared script (e.g. .github/scripts/verify-npm-package.sh <package-dir>), passing shasum -a 256 for this macOS job.
  • .github/workflows/release.yml#L490-L519: call the same shared script for each pnpm/npm/* package dir, passing sha256sum for this Linux job.
  • .github/workflows/release.yml#L787-L817: call the same shared script for each pnpr/npm/* package dir, passing sha256sum for this Linux job.
🤖 Prompt for 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.

In @.github/workflows/release.yml around lines 170 - 198, Extract the shared
manifest parsing, tarball packing, and payload hash verification into a reusable
.github/scripts/verify-npm-package.sh accepting a package directory and hash
command. Replace the inline logic at .github/workflows/release.yml lines 170-198
with calls for each package, passing shasum -a 256; update lines 490-519 and
787-817 to call the same script for each package, passing sha256sum. Preserve
the existing package lists and verification behavior at all three sites.
🤖 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.

Nitpick comments:
In @.github/workflows/release.yml:
- Around line 170-198: Extract the shared manifest parsing, tarball packing, and
payload hash verification into a reusable .github/scripts/verify-npm-package.sh
accepting a package directory and hash command. Replace the inline logic at
.github/workflows/release.yml lines 170-198 with calls for each package, passing
shasum -a 256; update lines 490-519 and 787-817 to call the same script for each
package, passing sha256sum. Preserve the existing package lists and verification
behavior at all three sites.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 536d1784-a265-460c-9167-6e8b19c04124

📥 Commits

Reviewing files that changed from the base of the PR and between dc1e99c and 7f36ae1.

📒 Files selected for processing (1)
  • .github/workflows/release.yml

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

Labels

reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants