Repository navigation
Conversation
The npm resolution verifier implemented three of its four violation codes: a lockfile entry whose tarball resolution records no `integrity` sailed through the verification gate — which had just printed its green check for that same lockfile — and was only refused later, one entry at a time, by the fetch path's `tarball_url_and_integrity` backstop. Add the missing `MISSING_TARBALL_INTEGRITY` rule so the gate reports every offending entry in one batched `ERR_PNPM_MISSING_TARBALL_INTEGRITY` error before anything is downloaded, matching `createNpmResolutionVerifier` in the TypeScript CLI. The check needs no network, so it runs before the registry-metadata shortcuts and applies to URL-keyed entries too, whose non-semver version otherwise skips the registry policies. `integrityRequired` joins the policy snapshot so a cache record written before the rule existed can't stat-fast-path around it. Two shapes that could have bought the exemption are closed along the way. `integrity: ''` parses into an SRI with zero hashes, which pins nothing and makes `Integrity::check` panic on `hashes[0]`; the new `LockfileResolution::checkable_integrity` reports it as absent, both here and in the fetch-path backstop, matching pnpm's `getExpectedIntegrity`. And the git-host archive exemption is now read from the tarball URL alone rather than the lockfile's own `gitHosted` marker, so an edited entry can't claim it for an arbitrary URL — the same rule `isRegistryTarballResolution` and `unverified_fetch_is_allowed` apply. The fetch-path refusal stays as the backstop for entries that reach a fetch without having passed the gate, as pnpm keeps `assertFetchableResolution` for the same reason. Closes #13364
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR rejects missing or empty tarball integrity during lockfile verification, derives git-host exemptions from URLs, preserves fetch-path validation, adds aggregated diagnostics, and expands test coverage. ChangesTarball integrity enforcement
Estimated code review effort: 3 (Moderate) | ~25 minutes Assessment against linked issues
Sequence Diagram(s)sequenceDiagram
participant LockfileResolution
participant NpmResolutionVerifier
participant LockfileVerification
participant VerifyError
LockfileResolution->>NpmResolutionVerifier: checkable_integrity()
NpmResolutionVerifier-->>NpmResolutionVerifier: reject missing or empty integrity
NpmResolutionVerifier->>LockfileVerification: emit MISSING_TARBALL_INTEGRITY
LockfileVerification->>VerifyError: aggregate offending entries
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
PR Summary by QodoReject tarball resolutions without integrity during lockfile verification
AI Description
Diagram
High-Level Assessment
Files changed (11)
|
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (2): Last reviewed commit: "test(cli): pin the missing-integrity ref..." | Re-trigger Greptile |
Micro-Benchmark ResultsLinux |
There was a problem hiding this comment.
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 `@pnpm/crates/cli/tests/tarball_url_dependency.rs`:
- Around line 292-299: Update the tarball URL dependency test around the
baseline and frozen install commands to reset or separately track mock requests
after the baseline, then assert the frozen install makes no tarball request
before validating the existing verification-gate error details. Ensure the
regression coverage proves rejection occurs at the verification gate before any
download.
🪄 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: bac25140-257f-4892-871c-d4d91d78f416
📒 Files selected for processing (11)
.changeset/verifier-rejects-integrity-less-tarballs.mdpnpm/crates/cli/tests/tarball_url_dependency.rspnpm/crates/lockfile-verification/src/errors.rspnpm/crates/lockfile-verification/src/errors/tests.rspnpm/crates/lockfile/src/resolution.rspnpm/crates/lockfile/src/resolution/tests.rspnpm/crates/package-manager/src/install_package_by_snapshot.rspnpm/crates/package-manager/src/install_package_by_snapshot/tests.rspnpm/crates/resolving-npm-resolver/src/create_npm_resolution_verifier.rspnpm/crates/resolving-npm-resolver/src/create_npm_resolution_verifier/tests.rspnpm/crates/resolving-npm-resolver/src/violation_codes.rs
Code Review by Qodo
Context used✅ Compliance rules (platform):
24 rules 1. Mocks outlive server drop
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13408 +/- ##
=======================================
Coverage 87.55% 87.56%
=======================================
Files 544 544
Lines 93464 93483 +19
=======================================
+ Hits 81832 81854 +22
+ Misses 11632 11629 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The frozen-install regression test asserted the batched verification error but left the baseline install's tarball mocks unchecked, so it would also have passed had the install downloaded the tarball first and only then reported the gate's error. Re-arm both endpoints with a zero-request expectation before the frozen command and assert them afterwards. The mocks still answer, so a fetch is observable rather than merely absent — flipping the expectation to one request fails with "received 0", which is what makes the assertion meaningful.
|
Code review by qodo was updated up to the latest commit c992c4d |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time). Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.6445029899200003,
"stddev": 0.1708181524100744,
"median": 2.71876110902,
"user": 1.5138039799999998,
"system": 1.29232196,
"min": 2.35463258602,
"max": 2.7870904860200003,
"times": [
2.7529267490200002,
2.7870904860200003,
2.7090906400200003,
2.77677028602,
2.71423834502,
2.72328387302,
2.77333190702,
2.35463258602,
2.39215974202,
2.4615052850200003
]
},
{
"command": "pacquet@main",
"mean": 2.43399903312,
"stddev": 0.1186679437443555,
"median": 2.36924873402,
"user": 1.5320598799999998,
"system": 1.25493056,
"min": 2.3472382360200004,
"max": 2.65055761202,
"times": [
2.6382539530200004,
2.47983566002,
2.37076301402,
2.34878364502,
2.42833953002,
2.34765455602,
2.65055761202,
2.3608296710200003,
2.3472382360200004,
2.3677344540200003
]
},
{
"command": "pnpr@HEAD",
"mean": 1.45696143162,
"stddev": 0.14146348431115738,
"median": 1.38451339852,
"user": 1.03239358,
"system": 1.1304631600000001,
"min": 1.34353435702,
"max": 1.78281590902,
"times": [
1.37279853402,
1.39490375902,
1.54148539802,
1.55884606402,
1.34465928802,
1.34353435702,
1.50397170702,
1.37412303802,
1.35247626202,
1.78281590902
]
},
{
"command": "pnpr@main",
"mean": 1.54143409992,
"stddev": 0.13006715767867183,
"median": 1.51339805302,
"user": 1.0617997799999999,
"system": 1.12475776,
"min": 1.38186097302,
"max": 1.74710113302,
"times": [
1.60965811802,
1.45539263802,
1.4051921890199999,
1.38186097302,
1.71672431002,
1.74710113302,
1.63899546202,
1.50296349402,
1.43262007002,
1.5238326120199999
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.25781880214,
"stddev": 0.0058550324892971675,
"median": 0.25621993484,
"user": 0.2159516,
"system": 0.53225168,
"min": 0.24967815784000005,
"max": 0.26749690284,
"times": [
0.25231970384,
0.25802125984,
0.24967815784000005,
0.25532659384,
0.26749690284,
0.25508101284,
0.26049853684,
0.26733983984,
0.25531273784,
0.25711327584
]
},
{
"command": "pacquet@main",
"mean": 0.25312572934,
"stddev": 0.006376320927283774,
"median": 0.25342787233999997,
"user": 0.21022289999999993,
"system": 0.51654638,
"min": 0.23934982384000003,
"max": 0.26200291684,
"times": [
0.25977208184,
0.25666138784,
0.25537930284,
0.25147644184,
0.26200291684,
0.23934982384000003,
0.25575049984,
0.24948979484000003,
0.25134494484,
0.25003009884
]
},
{
"command": "pnpr@HEAD",
"mean": 0.27287324694,
"stddev": 0.00670560851161877,
"median": 0.27098554784,
"user": 0.213727,
"system": 0.55118368,
"min": 0.26339225384,
"max": 0.28401915684,
"times": [
0.28282705084,
0.27113861484,
0.27079568184,
0.27083248084,
0.26961633984,
0.27447677684,
0.28401915684,
0.26339225384,
0.26541504884,
0.27621906484
]
},
{
"command": "pnpr@main",
"mean": 0.27149225534,
"stddev": 0.01094143775436827,
"median": 0.27062208534,
"user": 0.2266742,
"system": 0.5179359800000001,
"min": 0.25431405384,
"max": 0.29288922684,
"times": [
0.25431405384,
0.29288922684,
0.26378090284,
0.26885961984,
0.26062253884,
0.27010802084,
0.28042683884,
0.27863666084,
0.27414854084,
0.27113614984
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.76980125474,
"stddev": 0.014969540449375918,
"median": 2.77186227224,
"user": 1.6806085,
"system": 1.32081742,
"min": 2.74322161824,
"max": 2.78917522824,
"times": [
2.74322161824,
2.76474168724,
2.77571775524,
2.75368534624,
2.76876826824,
2.78917522824,
2.78111125224,
2.77495627624,
2.78805430624,
2.75858080924
]
},
{
"command": "pacquet@main",
"mean": 2.76423175264,
"stddev": 0.01904822823616466,
"median": 2.76262077224,
"user": 1.7076637,
"system": 1.28326022,
"min": 2.73684632924,
"max": 2.79693161824,
"times": [
2.75229546024,
2.79693161824,
2.7629612362400002,
2.73684632924,
2.7949733452400003,
2.76228030824,
2.75309098824,
2.74975619224,
2.76452479324,
2.76865725524
]
},
{
"command": "pnpr@HEAD",
"mean": 1.58046605404,
"stddev": 0.12621864643902272,
"median": 1.54295812924,
"user": 1.04787,
"system": 1.12260202,
"min": 1.42444444724,
"max": 1.7710402572400001,
"times": [
1.44500865824,
1.48673186224,
1.65727535124,
1.7710402572400001,
1.57480814224,
1.7576377762400002,
1.51110811624,
1.42444444724,
1.66994054724,
1.50666538224
]
},
{
"command": "pnpr@main",
"mean": 1.53531307274,
"stddev": 0.12721700679308356,
"median": 1.5069351582400001,
"user": 1.0146153,
"system": 1.18528482,
"min": 1.42663153824,
"max": 1.85180971024,
"times": [
1.59501547624,
1.55652934524,
1.46355366524,
1.85180971024,
1.42837132224,
1.42663153824,
1.55031665124,
1.4632193682399999,
1.56474881324,
1.45293483724
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.5950720906,
"stddev": 0.011317379988499448,
"median": 0.5945680106,
"user": 0.70738154,
"system": 0.6959299,
"min": 0.5786032576,
"max": 0.6093338366000001,
"times": [
0.5946972926,
0.5944387286,
0.6046720126,
0.5846289986000001,
0.6083196746,
0.6093338366000001,
0.6024980356,
0.5941026386,
0.5794264306,
0.5786032576
]
},
{
"command": "pacquet@main",
"mean": 0.5816272216,
"stddev": 0.007079491646863832,
"median": 0.5809754261,
"user": 0.6897452399999999,
"system": 0.6841213999999998,
"min": 0.5690710386000001,
"max": 0.5915772816,
"times": [
0.5821529246,
0.5849273776,
0.5915772816,
0.5907824806,
0.5755242426,
0.5788698966,
0.5868431906,
0.5797979276,
0.5690710386000001,
0.5767258556
]
},
{
"command": "pnpr@HEAD",
"mean": 0.3040822941,
"stddev": 0.004678539656528314,
"median": 0.3054998176,
"user": 0.19950754,
"system": 0.5325110999999999,
"min": 0.29746599960000003,
"max": 0.31023605060000004,
"times": [
0.3069228676,
0.29746599960000003,
0.3056218466,
0.3082386656,
0.2993508746,
0.30537778860000003,
0.3086613586,
0.31023605060000004,
0.2997287926,
0.2992186966
]
},
{
"command": "pnpr@main",
"mean": 0.29163267769999995,
"stddev": 0.012408953380774693,
"median": 0.2884995406,
"user": 0.19554953999999997,
"system": 0.4967911000000001,
"min": 0.2774226046,
"max": 0.3160574506,
"times": [
0.3026497516,
0.2827846016,
0.2824127246,
0.2919432796,
0.2850558016,
0.2774226046,
0.2796009706,
0.2990671426,
0.3160574506,
0.2993324496
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.89912872154,
"stddev": 0.009602573417486292,
"median": 1.89741227644,
"user": 0.9358619199999998,
"system": 0.76818244,
"min": 1.88231410544,
"max": 1.9153042664400002,
"times": [
1.9153042664400002,
1.8992110694400002,
1.8956028634400002,
1.9066355564400002,
1.89561348344,
1.8915032434400003,
1.9034960984400002,
1.88231410544,
1.8930081644400003,
1.9085983644400002
]
},
{
"command": "pacquet@main",
"mean": 1.8924245019400001,
"stddev": 0.014123402601901845,
"median": 1.8906598389400002,
"user": 0.9337495199999999,
"system": 0.74846684,
"min": 1.8670583734400001,
"max": 1.91093393444,
"times": [
1.9013716304400001,
1.8917069524400003,
1.90964552844,
1.8896127254400001,
1.9044224124400002,
1.88585507744,
1.8670583734400001,
1.8793588324400001,
1.8842795524400002,
1.91093393444
]
},
{
"command": "pnpr@HEAD",
"mean": 0.3038801537400001,
"stddev": 0.006824242462009328,
"median": 0.30451868244,
"user": 0.21110851999999997,
"system": 0.5216641399999999,
"min": 0.29393925944,
"max": 0.31336697744,
"times": [
0.31336697744,
0.30636699944,
0.31001740644,
0.31208031444,
0.29904796144,
0.29988271744,
0.30370533644000003,
0.29393925944,
0.29506253644,
0.30533202844
]
},
{
"command": "pnpr@main",
"mean": 0.30313480914,
"stddev": 0.005326784917049374,
"median": 0.30278856243999996,
"user": 0.20236492,
"system": 0.52953674,
"min": 0.29344269944,
"max": 0.31190417444,
"times": [
0.31190417444,
0.29997259644,
0.30338968544,
0.30226657844,
0.29967133044,
0.30569561044,
0.31034263544,
0.29344269944,
0.30331054644,
0.30135223444
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.36836027081999995,
"stddev": 0.012631555550319208,
"median": 0.36379138872,
"user": 0.36646638,
"system": 0.04867124,
"min": 0.35935046972,
"max": 0.40026179072,
"times": [
0.40026179072,
0.36262010072,
0.36481014972,
0.36278205572,
0.35935046972,
0.36230415972,
0.36589637672,
0.36480072172,
0.38030832772,
0.36046855572
]
},
{
"command": "pacquet@main",
"mean": 0.36108722772,
"stddev": 0.007055299588300311,
"median": 0.36486733322,
"user": 0.35148127999999995,
"system": 0.05868154,
"min": 0.34836144372,
"max": 0.36816859472,
"times": [
0.35909149872,
0.36543752272,
0.36457993372,
0.36515473272,
0.36711485772,
0.36816859472,
0.34836144372,
0.35294419872,
0.35371335272,
0.36630614172
]
},
{
"command": "pnpr@HEAD",
"mean": 0.08651084836705884,
"stddev": 0.002026111960134287,
"median": 0.08656026072,
"user": 0.020398327058823527,
"system": 0.008808708235294116,
"min": 0.08205244072000001,
"max": 0.08981667372000002,
"times": [
0.08447194772000001,
0.08851454172,
0.08839872372000002,
0.08931448172,
0.08462275172000001,
0.08731316772000002,
0.08981667372000002,
0.08507788472000001,
0.08576627672,
0.08351875972000002,
0.08647568672000001,
0.08422557572000001,
0.08582734072,
0.08963289872,
0.08494375372000001,
0.08903636972000001,
0.08710954572000001,
0.08715010172000001,
0.08644812572,
0.08749630172000002,
0.08711369372000001,
0.08282021972,
0.08658560372000002,
0.08306693272000001,
0.08837432772,
0.08653491772,
0.08205244072000001,
0.08835600372,
0.08663394372000001,
0.08504837972000001,
0.08635587172,
0.08754604372000001,
0.08921383272000001,
0.08650572372000001
]
},
{
"command": "pnpr@main",
"mean": 0.0867809464169697,
"stddev": 0.001829339226656898,
"median": 0.08680053572000002,
"user": 0.02126052848484848,
"system": 0.008152856363636364,
"min": 0.08203951572000001,
"max": 0.09040814272000001,
"times": [
0.08650761672000001,
0.08626853772000001,
0.09040814272000001,
0.08637614072000001,
0.08779907872,
0.08643874772000001,
0.08680053572000002,
0.08461459672,
0.08534319272000002,
0.09026010472000001,
0.08689190672000001,
0.08480833972000001,
0.08310496472000001,
0.08983587872000001,
0.08565315372000001,
0.08690574372000001,
0.08634989072000002,
0.08203951572000001,
0.08426119272000002,
0.08827646372000002,
0.08815862272000001,
0.08652838472,
0.08806349472000001,
0.08680014472000001,
0.08658656472000001,
0.08836849672000001,
0.08744065672000001,
0.08505881972000001,
0.08844602172000002,
0.08772050072000001,
0.08703584772000002,
0.08768125772000002,
0.08693867472000001
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.541611163000001,
"stddev": 0.12036187193627791,
"median": 4.5201314165,
"user": 1.6882810199999998,
"system": 1.3846747799999997,
"min": 4.432040328,
"max": 4.786074264,
"times": [
4.667218001,
4.437078809,
4.569138005,
4.471124828,
4.435514805,
4.4409496090000005,
4.574327981,
4.786074264,
4.602645,
4.432040328
]
},
{
"command": "pacquet@main",
"mean": 4.5276300449,
"stddev": 0.11217235395813083,
"median": 4.4790550765,
"user": 1.73327912,
"system": 1.3506428799999999,
"min": 4.434768226,
"max": 4.732488941,
"times": [
4.505215476,
4.463925217,
4.441222511,
4.494184936,
4.438060561,
4.732488941,
4.46065419,
4.705895029,
4.599885362,
4.434768226
]
},
{
"command": "pnpr@HEAD",
"mean": 3.5025426809000004,
"stddev": 0.0944727675842613,
"median": 3.454788917,
"user": 1.19310652,
"system": 1.1781256799999997,
"min": 3.441753561,
"max": 3.72627367,
"times": [
3.4499197280000002,
3.72627367,
3.511980151,
3.441753561,
3.450608871,
3.4522606590000002,
3.4677504150000003,
3.6153019200000003,
3.456436142,
3.453141692
]
},
{
"command": "pnpr@main",
"mean": 3.5306553121999995,
"stddev": 0.12101618145867296,
"median": 3.4794567195,
"user": 1.18066352,
"system": 1.21111058,
"min": 3.433536735,
"max": 3.781793654,
"times": [
3.455414936,
3.723046707,
3.781793654,
3.50364662,
3.48889527,
3.433536735,
3.451556488,
3.465737891,
3.470018169,
3.532906652
]
}
]
} |
|
| Project | pnpm's project |
| Branch | pr/13408 |
| Testbed | pnpr |
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the--ci-only-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 1,424.44 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 293.94 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 297.47 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 82.05 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,343.53 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,441.75 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 263.39 ms |
pnpm#13408) The npm resolution verifier implemented three of its four violation codes: a lockfile entry whose tarball resolution records no `integrity` sailed through the verification gate — which had just printed its green check for that same lockfile — and was only refused later, one entry at a time, by the fetch path's `tarball_url_and_integrity` backstop. Add the missing `MISSING_TARBALL_INTEGRITY` rule so the gate reports every offending entry in one batched `ERR_PNPM_MISSING_TARBALL_INTEGRITY` error before anything is downloaded, matching `createNpmResolutionVerifier` in the TypeScript CLI. The check needs no network, so it runs before the registry-metadata shortcuts and applies to URL-keyed entries too, whose non-semver version otherwise skips the registry policies. `integrityRequired` joins the policy snapshot so a cache record written before the rule existed can't stat-fast-path around it. Two shapes that could have bought the exemption are closed along the way. `integrity: ''` parses into an SRI with zero hashes, which pins nothing and makes `Integrity::check` panic on `hashes[0]`; the new `LockfileResolution::checkable_integrity` reports it as absent, both here and in the fetch-path backstop, matching pnpm's `getExpectedIntegrity`. And the git-host archive exemption is now read from the tarball URL alone rather than the lockfile's own `gitHosted` marker, so an edited entry can't claim it for an arbitrary URL — the same rule `isRegistryTarballResolution` and `unverified_fetch_is_allowed` apply. The fetch-path refusal stays as the backstop for entries that reach a fetch without having passed the gate, as pnpm keeps `assertFetchableResolution` for the same reason. Closes pnpm#13364
Summary
Closes #13364.
pacquet's npm resolution verifier implemented three of its four violation codes. A lockfile entry whose tarball resolution records no
integritypassed the verification gate — right after it printed✓ Lockfile passes supply-chain policiesfor that same lockfile — and was refused later by the fetch path'starball_url_and_integritybackstop, one entry per install.This adds the missing
MISSING_TARBALL_INTEGRITYrule toNpmResolutionVerifier, so the refusal now comes from the gate, batched, before anything is downloaded — the same layer the TypeScript CLI raises it from (createNpmResolutionVerifier):The fetch-path refusal stays as the backstop for entries that reach a fetch without having passed the gate, exactly as pnpm keeps
assertFetchableResolution.Two shapes that could have bought the exemption are closed along the way:
integrity: ''parses into an SRI with zero hashes. It pins nothing, andssri'sIntegrity::checkpanics onhashes[0]for it, so a hand-edited lockfile could turn an unverified fetch into aTaskJoinerror instead of a clean refusal. The newLockfileResolution::checkable_integrityreports it as absent, in the verifier and in the fetch-path backstop, matching pnpm'sgetExpectedIntegrity(typeof integrity === 'string' && integrity.length > 0).is_git_hosted_tarball_url) instead of the lockfile's owngitHostedmarker, so an edited entry can't claim it for an arbitrary URL. This is whatisRegistryTarballResolutionand pacquet's ownunverified_fetch_is_allowedalready do.integrityRequired: truejoins the policy snapshot (alongsidetarballUrlBinding), so a verification-cache record written before this rule existed failscan_trust_past_checkand forces a re-verification instead of stat-fast-pathing around the new check. The TypeScript verifier already records the same flag.Known remaining divergence (follow-up, not fixed here)
For a URL-keyed entry the two stacks label the offending entry differently:
[email protected]—nameVerFromPkgSnapshotprefers the snapshot'sversionand carries the URL separately asnonSemverVersion.pkg-from-tarball@http://…/pkg-from-tarball-1.0.0.tgz—collect_candidatestakes the version from the dep-path suffix.Closing that gap means giving
VerifyCtxanon_semver_versionfield (the verifier currently infers "skip the registry policies" from the version not parsing as semver), which also unlocks pnpm'sTARBALL_URL_MISMATCH-for-a-non-semver-version rule. That is candidate-identity parity rather than a missing violation code, so it is left out of this PR — happy to fold it in if you'd rather have it here.Two adjacent notes while in this code:
TARBALL_URL_MISMATCHstill surfaces asERR_PNPM_LOCKFILE_RESOLUTION_VERIFICATIONin pacquet, where pnpm throwsERR_PNPM_TARBALL_URL_MISMATCH(buildVerificationErroruses the violation's own code). Untouched here; say the word and I'll add the variant.resolution: {}(bothintegrityandtarballdeleted) is rejected by pacquet at lockfile-parse time — noLockfileResolutionvariant matches — rather than as aMISSING_TARBALL_INTEGRITYviolation. Both refuse the install; only the message differs.Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting.pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Written by an agent (Claude Code, claude-opus-5).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit
integrity, before any downloads.ERR_PNPM_MISSING_TARBALL_INTEGRITYerror with a remediation command.integrity: ''and missing-integrity handling across tarball/registry cases, including git-hosted URL scenarios.