Skip to content

Pin the xlsx tarball by integrity, not just by URL - #9

Open
hatemhamad wants to merge 1 commit into
punkch:mainfrom
hatemhamad:fix/pin-xlsx-tarball-integrity
Open

Pin the xlsx tarball by integrity, not just by URL#9
hatemhamad wants to merge 1 commit into
punkch:mainfrom
hatemhamad:fix/pin-xlsx-tarball-integrity

Conversation

@hatemhamad

Copy link
Copy Markdown

The lockfile records this dependency as a URL with no checksum:

xlsx@https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz:
  resolution: {tarball: https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz}

Every other dependency carries an integrity hash, so the lockfile pins what will be installed. This one pins only where to look for it. Every install — CI, a fresh clone, a deploy build — fetches from that host and accepts whatever comes back, with no check that it is the same payload anyone reviewed. If the bytes at that URL ever change, nothing notices.

pnpm does honour integrity for URL tarballs; it simply does not compute one for a bare URL. Verified both directions: with a deliberately wrong hash the install fails with ERR_PNPM_TARBALL_INTEGRITY and names the mismatch, and with the hash below it succeeds.

The recorded hash is of the tarball the URL currently serves, which is the same payload installs have been fetching all along. That is worth being precise about: this does not prove the bytes are what the publisher intended, it makes any future change to them fail loudly instead of passing silently. That is the property a lockfile is supposed to have.

No behaviour change — the same bytes are installed either way.

The lockfile records this dependency as a URL with no checksum:

    xlsx@https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz:
      resolution: {tarball: https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz}

Every other dependency carries an integrity hash, so the lockfile pins what will
be installed. This one pins only where to look for it. Every install — CI, a
fresh clone, a deploy build — fetches from that host and accepts whatever comes
back, with no check that it is the same payload anyone reviewed. If the bytes at
that URL ever change, nothing notices.

pnpm does honour integrity for URL tarballs; it simply does not compute one for
a bare URL. Verified both directions: with a deliberately wrong hash the install
fails with ERR_PNPM_TARBALL_INTEGRITY and names the mismatch, and with the hash
below it succeeds.

The recorded hash is of the tarball the URL currently serves, which is the same
payload installs have been fetching all along. That is worth being precise
about: this does not prove the bytes are what the publisher intended, it makes
any future change to them fail loudly instead of passing silently. That is the
property a lockfile is supposed to have.

No behaviour change — the same bytes are installed either way.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant