Repository navigation
fix(pm): verify unpinned package-manager downloads against registry integrity - #3547
Conversation
…ntegrity Without a `packageManager` hash, npm, pnpm 11 and earlier, and Yarn were installed without any integrity check, while bun and pnpm 12+ already verified their platform tarball against the registry `dist.integrity`. Corepack used to verify these downloads before it was removed. An unpinned download now fetches the version metadata and verifies the tarball against `dist.integrity` before extraction. A pinned download keeps using the pin and does not fetch metadata. A registry that omits `dist.integrity` now fails the install with `MissingRegistryIntegrity` for every manager, including the bun and pnpm 12+ platform tarballs.
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Match the existing bun and pnpm 12+ platform tarball behavior instead of failing the install, so a mirror without dist.integrity keeps working.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: edf37a510e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The test served only the tarball, so the new metadata request returned 404 before the temp dir existed and the cleanup assertion passed vacuously.
Use is_not_found for registry 404 mapping, name managers by PackageManagerType, and share the test sri and mount helpers. Remove doc and inline comments that restate the code.
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
An unpinned npm download now reads dist.integrity from the version metadata, so the mock registry must answer that request.
Summary
Without a
packageManagerhash, Vite+ installed npm, pnpm 11 and earlier, and Yarn without any integrity check. Bun and pnpm 12 and later already verified their platform tarball against the registrydist.integrity, so the same unpinned project was verified or not depending on the package manager. Corepack used to verify these downloads, and that check was lost when it was removed in #2391.An unpinned download now fetches the version metadata and verifies the tarball against
dist.integritybefore extraction. A pinned download is unchanged. It is still verified against the pin and does not fetch metadata, which keeps the principle from #3400 that a declared pin takes precedence over what the registry reports.