Skip to content

Record integrity hashes for the four @buf lockfile entries - #143

Open
jamesarich wants to merge 1 commit into
masterfrom
fix/buf-lockfile-integrity
Open

jamesarich wants to merge 1 commit into
masterfrom
fix/buf-lockfile-integrity

Conversation

@jamesarich

Copy link
Copy Markdown
Contributor

Fixes #142.

pnpm install fails on any pnpm newer than 9, because the four @buf entries in pnpm-lock.yaml carry no integrity hash. CI does not catch it: pnpm/action-setup is pinned to version: 9.

buf.build's registry generates tarballs on demand and its packument has only a tarball URL — no integrity, no shasum — so pnpm 8 recorded nothing when it wrote these entries. pnpm 10 made that a hard error.

What this changes

Four lines. The existing resolution: {tarball: ...} gains an integrity:; nothing else moves.

-    resolution: {tarball: https://buf.build/gen/npm/v1/@buf/meshtastic_api.bufbuild_es/-/...tgz}
+    resolution: {tarball: https://buf.build/gen/npm/v1/@buf/meshtastic_api.bufbuild_es/-/...tgz, integrity: sha512-G1+PEr0X...}

No version changes, no resolution changes, no package.json change. In particular this does not touch the pnpm devDependency — that is dependabot's #101 and is unrelated to what actually resolves the install.

Where the hashes come from

Each is the sha512 of the tarball buf.build serves for that exact version. They are byte-identical to what pnpm 11 computes when it resolves these packages from a fresh lockfile, which is the mechanism newer pnpm uses for registries that cannot supply a hash:

$ curl -sL '<tarball url>' | openssl dgst -sha512 -binary | base64
G1+PEr0XHM4s5y+poOkrveCysmnpPVdGCZjSAj62FsR5s93H3MO2jZNAbMp1DXq8/Wch9SpAzR/Hc2PK9jGIhA==

Regenerating the lockfile instead would also work, but it moves every unrelated dependency in the same commit (wrangler, yaml, @bufbuild/protobuf 1.7.2 → 1.10.1, …), which is a much harder diff to review for a supply-chain fix. --no-frozen-lockfile does not work at all: pnpm will not reuse an entry it has already rejected.

Testing

Installed against all three majors with --frozen-lockfile, and the lockfile is byte-stable after each:

pnpm before after
9.15.9 ok ok
10.34.4 ERR_PNPM_MISSING_TARBALL_INTEGRITY ok
11.25.0 rejected by lockfile policy ok — Lockfile passes supply-chain policies (358 entries)

Then the repo's own CI steps on pnpm 9 / Node 22:

  • pnpm install --ignore-scripts=false — ok
  • pnpm build — ok, dist/index.js emitted
  • pnpm validate:maintenance-uf2 — ok, 4 erase image(s), 19 OTAFIX board(s), 17 supported target(s)

Draft because the hashes pin what buf.build serves today; worth a second pair of eyes on that being the intent before it merges.

The @buf packages resolve through buf.build's npm registry, whose packument
carries only a tarball URL - its `dist` has no `integrity` and no `shasum`.
pnpm 8, which wrote these entries, took that at face value and recorded no
hash. pnpm 10 turned a missing hash from a warning into a hard error, so any
install on pnpm 10 or 11 fails against this lockfile:

  pnpm 11.25.0  ERR  the lockfile contains entries that the active policies
                     reject (all four named)
  pnpm 10.34.4  ERR  ERR_PNPM_MISSING_TARBALL_INTEGRITY
  pnpm  9.15.9  ok   - which is why CI is green; it pins 9

Newer pnpm computes the hash from the downloaded tarball, but only on a fresh
resolution: it will not reuse an entry it has already rejected, so
`--no-frozen-lockfile` does not repair it and a full regeneration would move
every unrelated dependency at the same time.

So write just the hashes. Each is the sha512 of the tarball buf.build serves
today, which is byte-identical to what pnpm 11 computes when it resolves these
packages from scratch. No version changes, no resolution changes.

Verified against all three majors with the repo's own steps - `pnpm install
--ignore-scripts=false`, `pnpm build` (dist/index.js emitted), and
`pnpm validate:maintenance-uf2`. The lockfile is byte-stable after each.
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 5637de28-9c96-4d7b-a716-0e0103066a6a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • No new commits to review - use @coderabbitai full review for a full pass

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.

@jamesarich
jamesarich marked this pull request as ready for review September 15, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pnpm-lock.yaml cannot be installed by pnpm 10 or 11: the four @buf entries have no integrity hash

1 participant