Repository navigation
fix(pm): require registry integrity for package-manager downloads that no pin covers - #3553
Merged
Merged
Conversation
Contributor
CLI artifact sizes (
|
| Artifact | Format | Base | PR | Change |
|---|---|---|---|---|
packages/cli/dist |
Directory total | 2.38 MiB | 2.38 MiB | 0 B (0.00%) |
packages/core/dist |
Directory total | 4.11 MiB | 4.11 MiB | 0 B (0.00%) |
| Combined package dist | Directory total | 6.49 MiB | 6.49 MiB | 0 B (0.00%) |
vp (Linux x64) |
Binary | 8.56 MiB | 8.57 MiB | +8.05 KiB (+0.09%) |
vp (Linux x64) |
gzip -9 | 3.92 MiB | 3.92 MiB | +897 B (+0.02%) |
| NAPI (Linux x64) | Binary | 37.29 MiB | 37.31 MiB | +16.13 KiB (+0.04%) |
| NAPI (Linux x64) | gzip -9 | 14.91 MiB | 14.91 MiB | +2.36 KiB (+0.02%) |
vp (macOS ARM64) |
Binary | 5.61 MiB | 5.61 MiB | +80 B (+0.00%) |
vp (macOS ARM64) |
gzip -9 | 3.34 MiB | 3.35 MiB | +3.61 KiB (+0.11%) |
| NAPI (macOS ARM64) | Binary | 43.83 MiB | 43.83 MiB | +32 B (+0.00%) |
| NAPI (macOS ARM64) | gzip -9 | 19.03 MiB | 19.03 MiB | +1.52 KiB (+0.01%) |
vp (Windows x64) |
Binary | 6.64 MiB | 6.65 MiB | +9.50 KiB (+0.14%) |
vp (Windows x64) |
gzip -9 | 3.03 MiB | 3.03 MiB | +2.59 KiB (+0.08%) |
| NAPI (Windows x64) | Binary | 33.24 MiB | 33.25 MiB | +9.00 KiB (+0.03%) |
| NAPI (Windows x64) | gzip -9 | 13.63 MiB | 13.64 MiB | +5.28 KiB (+0.04%) |
| Trampoline (Windows x64) | Binary | 13.50 KiB | 13.50 KiB | 0 B (0.00%) |
| Trampoline (Windows x64) | gzip -9 | 7.09 KiB | 7.09 KiB | 0 B (0.00%) |
| Installer (Windows x64) | Binary | 4.69 MiB | 4.69 MiB | +7.50 KiB (+0.16%) |
| Installer (Windows x64) | gzip -9 | 2.25 MiB | 2.25 MiB | +3.75 KiB (+0.16%) |
cpojer
approved these changes
Nov 23, 2026
jong-kyung
approved these changes
Nov 23, 2026
fengmk2
force-pushed
the
fix/pm-tarball-only-mirror
branch
from
November 23, 2026 11:42
370f060 to
020aa19
Compare
fengmk2
force-pushed
the
fix/pm-tarball-only-mirror
branch
from
November 23, 2026 13:25
5f3ccb7 to
3c6a035
Compare
An unpinned install fetches the version document for `dist.integrity`.
When that document returned 404, the install failed even when the
tarball existed. A 404 now has the same result as a document that omits
`dist.integrity`: the install continues without the registry check and
vp logs it at debug level. A missing version still fails with
`PackageManagerVersionNotFound` from the tarball request.
Replace the three hash-related parameters of the tgz download helper
with a `TgzDownload` descriptor. `archive_digest` always covers the
`.tgz` bytes, and `Unpack::Entry { digest }` covers the extracted file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Bun or pnpm 12+ pin covers only the main tarball, so the registry integrity is the only check of the platform executable. When the registry did not serve the platform version document, a pinned install continued without that check and added the executable to the verified namespace. Let callers choose the 404 policy: unpinned installs continue, and pinned native installs keep the error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the main-tarball pin check and the platform integrity fetch of Bun and pnpm 12+ into `verify_pin_and_fetch_platform_integrity`, so the rule that a pin covers only the main tarball lives in one place. Merge the unpinned registry integrity tests into one table, share the native platform fixtures, and run the single-entry digest cases without the retry delays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A version document that omits `dist.integrity` still installs the platform executable without the check, as #3554 tracks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An unpinned download, and the platform package of Bun or pnpm 12+, now need the registry `dist.integrity`. vp reads the version document first, then the abbreviated package document when the version document is missing or omits the field. When neither gives it, the install fails with `PackageManagerIntegrityUnavailable` before the download, and the error tells the user how to fix it. A pinned npm, pnpm 11 and earlier, or Yarn install still never fetches metadata. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Make `RegistryPackument` generic over the version metadata, so the integrity lookup and the version list read one struct. Share the version-document mock between the test helpers, narrow an integrity parameter that is never `None`, and drop a slow test case that other cases already cover. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fengmk2
force-pushed
the
fix/pm-tarball-only-mirror
branch
from
November 23, 2026 13:50
3c6a035 to
b8f6a61
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#3547 checks unpinned package-manager downloads against the registry
dist.integrity. When the version document omitted the field, the install continued without a check. When the version document returned 404, the install failed withPackageManagerVersionNotFound, even if the package document had the integrity.This PR makes one rule: when no
packageManagerpin covers the files that vp runs, vp requires the registrydist.integrity. The rule applies to these downloads:Pinned npm, pnpm 11 and earlier, and Yarn installs do not change. They never fetch metadata.
Lookup
<registry>/<name>/<version>.dist.integrity, vp reads the abbreviated package document,<registry>/<name>.npm installreads the same document when no lockfile pins a package.PackageManagerIntegrityUnavailablebefore the download.dist.integritydist.integrityPackageManagerVersionNotFounddist.integrityPackageManagerVersionNotFoundon a 404PackageManagerIntegrityUnavailable, nothing downloadedPackageManagerVersionNotFoundOn registry.npmjs.org, every version of
npm,pnpm,yarn,@yarnpkg/cli-dist, andbunhasdist.integrity, and so does every version of the Bun and pnpm platform packages that I sampled. So the first request succeeds there.The new error
PackageManagerIntegrityUnavailablenames the package and the package document URL, and gives a hint:packageManagerfield, or use a registry that serves package metadata.Error::is_integrity_failureincludes the new error. So a command that prepares a managed package manager stops with this error, and does not fall back to the package manager onPATH.Closes #3554
One descriptor for each download
download_and_extract_tgz_with_hash_and_configtookarchive_file,expected_hash, andtarball_hash.expected_hashcovered the archive or one entry, depending onarchive_file. Withoutarchive_file, the two hash parameters were the same check.download_and_extract_tgznow takes aTgzDownload:archive_digestalways covers the.tgzbytes, and vp checks it before it reads any entry.unpackisUnpack::All, orUnpack::Entry { path, digest }, wheredigestcovers the extracted file only.download_package_manager_innerselects both values in one place. Bun and pnpm 12+ shareverify_pin_and_fetch_platform_integrity, which checks the pin against the main tarball and then fetches the platform integrity.🤖 Generated with Claude Code