Repository navigation
fix(self-update): support registries without canonical tarball URLs or signature metadata - #13728
Conversation
…r signature metadata The package-manager bootstrap hardening (#12296, #12292) broke version switching on private mirrors and feed proxies: 1. Registries that advertise tarballs on a different host than the one serving the packument (load-balanced proxies, Artifactory-style mirrors) always retain a tarball URL in the resolution, which the integrity-only env-lockfile validation then rejects (Closes #13619). 2. Registries that serve no dist.signatures fail the engine identity check outright (Closes #13147). Fixes, in both stacks: - Package-manager dependency resolutions are now recorded integrity-only: the advertised tarball URL is dropped at resolution time, because the bootstrap never fetches a lockfile-recorded URL anyway - the download URL is always derived from the trusted bootstrap registries. This keeps freshly resolved entries in exactly the shape the strict validation accepts, without weakening the validation itself. Dropping the URL does not perturb the global-virtual-store slot hash, which is derived from the integrity alone whenever one is present. - Persisted entries that fail the validation (e.g. tarball-carrying resolutions written by an earlier pnpm - including 11.5.3+, which wrote them before rejecting them) are discarded and re-resolved through the trusted bootstrap registries instead of failing every command. - Engine identity verification now falls back to fetching the signature from the canonical npm registry when the configured registry cannot provide a verifiable one. The signature is verified against the same embedded npm keys over the installed integrity, so where the signature bytes come from does not change what they prove; this also rides out a mirror serving stale signatures from a rotated-out key. - When no signature is obtainable at all (both sources unreachable, or the registry publishes only a shasum, so the sha1 pin can never be covered by an npm signature), the switch proceeds with a warning - but only when the engine resolves through a non-canonical registry, which can only come from the user's own trusted (non-project) configuration. A signature that exists but does not validate still hard-fails, as does a reachable canonical registry answering that no signed release exists. Security invariants preserved: a cloned repository still cannot steer the bootstrap fetch (URLs never come from the lockfile; registries never come from project config), repo-controlled integrity can only pin bytes (a mismatch fails the download), and tamper evidence always fails closed. The residual trust in the warn-and-proceed path equals the trust the user already places in their own configured registry for every package they install from it, matching corepack's handling of custom registries. Verified end to end against packagefeedproxy.microsoft.io, the registry from the report in the discussion (pnpm/orgs discussion 3787): the version switch now succeeds on both the legacy packageManager path and the persisting devEngines path. Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughPackage-manager switching now repairs invalid persisted resolutions and converts mirror tarballs to integrity-only records. Signature verification can use the canonical npm registry when configured registries lack metadata. Invalid signatures and unsafe canonical-registry failures remain errors. ChangesPackage-manager bootstrap
Signature fallback verification
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant BootstrapResolver
participant ConfiguredRegistry
participant SignatureVerifier
participant CanonicalNpmRegistry
CLI->>BootstrapResolver: resolve packageManager version
BootstrapResolver->>ConfiguredRegistry: fetch package metadata
ConfiguredRegistry-->>BootstrapResolver: tarball and integrity
BootstrapResolver-->>CLI: integrity-only bootstrap resolution
CLI->>SignatureVerifier: verify installed engine
SignatureVerifier->>ConfiguredRegistry: request signatures
ConfiguredRegistry-->>SignatureVerifier: signature metadata or missing metadata
SignatureVerifier->>CanonicalNpmRegistry: request fallback metadata
CanonicalNpmRegistry-->>SignatureVerifier: fallback signature result
Assessment against linked issues
Possibly related PRs
Suggested labels: ✨ 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 QodoFix self-update on mirrors lacking canonical tarball URLs or npm signatures
AI Description
Diagram
High-Level Assessment
Files changed (20)
|
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (6): Last reviewed commit: "fix(deps.security.signatures): sanitize ..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pnpm/crates/cli/src/cli_args/self_update.rs (1)
281-288: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftRepair invalid persisted resolutions before
self-update.Line 287 passes
false, so a matching recorded closure takes the fast path and retains old tarball resolutions.switch_targettreats that shape as invalid and forces replacement at Lines 579-593 ofpnpm/crates/cli/src/cli_args/pre_command.rs.When a global environment has a persisted invalid closure for the requested version,
self-updatedoes not perform the recovery described by this PR. Reuse the bootstrap-resolution validation before this call and force synchronization only when that validation fails. Add a regression test with a persisted tarball resolution and an already-recorded self-update target.🤖 Prompt for 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. In `@pnpm/crates/cli/src/cli_args/self_update.rs` around lines 281 - 288, Validate the persisted bootstrap resolution before the self-update call in the relevant self-update flow, using the same invalid-closure criteria as switch_target. Pass the resulting force-sync decision instead of the hardcoded false to config_deps::sync_package_manager_dependencies, so invalid tarball resolutions are replaced while valid closures retain the fast path. Add a regression test covering a persisted tarball resolution with an already-recorded self-update target.
🧹 Nitpick comments (2)
pnpm/crates/cli/src/cli_args/self_update/verify_engine/tests.rs (1)
208-298: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for the equal-registry short-circuit.
find_signature_failureskips the fallback whenequal_registries(&component.registry, fallback_registry)is true. No test in this file exercises that branch. The TypeScript suite covers it ("does not consult the fallback when it is the package registry itself" inpnpm11/deps/security/signatures/test/verifySignatures.ts). Add the matching Rust test to keep both suites aligned.🧪 Proposed test
#[tokio::test] async fn does_not_consult_the_fallback_when_it_is_the_component_registry() { let mut mirror = mockito::Server::new_async().await; let component = EngineComponent { registry: format!("{}/", mirror.url()), ..component() }; // `expect(1)` fails the mock assertion if a second request arrives. let mirror_mock = mirror .mock("GET", "/pnpm") .with_status(200) .with_body(packument_body("pnpm", "12.0.0", "[]")) .expect(1) .create_async() .await; let failure = find_failure_with_fallback(&component, &mirror.url()) .await .expect("failure expected"); assert!(matches!(failure.category, FailureCategory::Absent)); mirror_mock.assert_async().await; }🤖 Prompt for 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. In `@pnpm/crates/cli/src/cli_args/self_update/verify_engine/tests.rs` around lines 208 - 298, Add a Tokio test alongside the existing fallback tests covering find_signature_failure when fallback_registry equals component.registry. Mock the component registry’s single packument request with an expectation of exactly one call and no signatures, invoke find_failure_with_fallback using the same registry URL, assert an Absent failure, and verify the mock so any fallback request fails the test.pnpm11/engine/pm/commands/test/self-updater/verifyPnpmEngineIdentity.test.ts (1)
71-77: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the warning, not only the resolution.
Both tests are named "warns and proceeds", but they assert only that the promise resolves. The warning emitted through
globalWarnis the new user-visible behavior of this change. A regression that drops theglobalWarncall would keep both tests green. Spy on the logger and assert the message.🧪 Proposed assertion
+import { globalWarn } from '`@pnpm/logger`' + +jest.mock('`@pnpm/logger`', () => ({ + ...jest.requireActual('`@pnpm/logger`'), + globalWarn: jest.fn(), +}))test('warns and proceeds when a user-configured registry is unreachable and no signature is obtainable', async () => { await expect(verifyPnpmEngineIdentity(envLockfile(), '9.1.0', optsTrusting(createSigningKey()))).resolves.toBeUndefined() + expect(globalWarn).toHaveBeenCalledWith(expect.stringContaining('could not be verified')) })Also applies to: 104-113
🤖 Prompt for 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. In `@pnpm11/engine/pm/commands/test/self-updater/verifyPnpmEngineIdentity.test.ts` around lines 71 - 77, Update the “warns and proceeds” tests around verifyPnpmEngineIdentity to spy on globalWarn and assert it is called with the expected warning message, while retaining the existing resolution assertions. Apply the same verification to both affected test cases.
🤖 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 `@pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts`:
- Around line 135-138: Update isTolerableWithoutSignature to use the shared
equalRegistries helper instead of regex-based, case-sensitive trailing-slash
comparisons. Export equalRegistries from verifySignatures.ts and import it from
`@pnpm/deps.security.signatures`, preserving the existing unreachable/uncovered
condition while ensuring canonical registry matching is case-insensitive and
normalized consistently.
In `@pnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.ts`:
- Around line 118-144: Add focused TypeScript regression tests in
resolvePackageManagerIntegrities.test.ts for stripRegistryTarballUrls via
resolvePackageManagerIntegrities: verify mirror-hosted registry tarballs persist
only a non-empty integrity, while file: tarballs, gitHosted resolutions, and
path resolutions retain their existing shape. Keep pnpm and pacquet behavior
unchanged and add the required accurate changeset.
---
Outside diff comments:
In `@pnpm/crates/cli/src/cli_args/self_update.rs`:
- Around line 281-288: Validate the persisted bootstrap resolution before the
self-update call in the relevant self-update flow, using the same
invalid-closure criteria as switch_target. Pass the resulting force-sync
decision instead of the hardcoded false to
config_deps::sync_package_manager_dependencies, so invalid tarball resolutions
are replaced while valid closures retain the fast path. Add a regression test
covering a persisted tarball resolution with an already-recorded self-update
target.
---
Nitpick comments:
In `@pnpm/crates/cli/src/cli_args/self_update/verify_engine/tests.rs`:
- Around line 208-298: Add a Tokio test alongside the existing fallback tests
covering find_signature_failure when fallback_registry equals
component.registry. Mock the component registry’s single packument request with
an expectation of exactly one call and no signatures, invoke
find_failure_with_fallback using the same registry URL, assert an Absent
failure, and verify the mock so any fallback request fails the test.
In
`@pnpm11/engine/pm/commands/test/self-updater/verifyPnpmEngineIdentity.test.ts`:
- Around line 71-77: Update the “warns and proceeds” tests around
verifyPnpmEngineIdentity to spy on globalWarn and assert it is called with the
expected warning message, while retaining the existing resolution assertions.
Apply the same verification to both affected test cases.
🪄 Autofix
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: aec457fc-da19-4c07-bb7b-3bffe23edcd5
📒 Files selected for processing (20)
.changeset/pm-bootstrap-nonderivable-tarball-registries.md.changeset/pm-signature-fallback-registry.mdpnpm/crates/cli/src/cli_args/pipelines.rspnpm/crates/cli/src/cli_args/pre_command.rspnpm/crates/cli/src/cli_args/pre_command/tests.rspnpm/crates/cli/src/cli_args/self_update.rspnpm/crates/cli/src/cli_args/self_update/verify_engine.rspnpm/crates/cli/src/cli_args/self_update/verify_engine/tests.rspnpm/crates/cli/src/cli_args/with.rspnpm/crates/cli/src/cli_args/with/install_pnpm_to_store.rspnpm/crates/cli/src/config_deps.rspnpm/crates/env-installer/src/resolve_package_manager_integrities.rspnpm/crates/env-installer/src/tests.rspnpm11/deps/security/signatures/src/verifySignatures.tspnpm11/deps/security/signatures/test/verifySignatures.tspnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.tspnpm11/engine/pm/commands/test/self-updater/verifyPnpmEngineIdentity.test.tspnpm11/installing/env-installer/src/resolvePackageManagerIntegrities.tspnpm11/pnpm/src/switchCliVersion.test.tspnpm11/pnpm/src/switchCliVersion.ts
Micro-Benchmark ResultsLinux |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #13728 +/- ##
========================================
Coverage 88.22% 88.23%
========================================
Files 616 616
Lines 100163 100306 +143
========================================
+ Hits 88373 88505 +132
- Misses 11790 11801 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Code Review by Qodo
1.
|
PR Code Suggestions ✨Latest suggestions up to 09333a6 Warning
Previous suggestionsSuggestions up to commit b66de95
Suggestions up to commit 323cddd
✅ Suggestions up to commit 9d273fe
Suggestions
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Integrated-Benchmark Report (Linux)Commit: Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. 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.49009939364,
"stddev": 0.13454831885069826,
"median": 2.4542165526399997,
"user": 1.7044919999999997,
"system": 1.3119212199999999,
"min": 2.3521558371399998,
"max": 2.7193407761399997,
"times": [
2.3521558371399998,
2.36654298614,
2.4633141991399996,
2.7193407761399997,
2.3552687251399997,
2.50220833214,
2.42921018414,
2.44511890614,
2.70442196514,
2.56341202514
]
},
{
"command": "pacquet@main",
"mean": 2.53292229814,
"stddev": 0.1657206761646974,
"median": 2.5000710586399997,
"user": 1.7023839999999997,
"system": 1.28722332,
"min": 2.34361865814,
"max": 2.76679924414,
"times": [
2.34705327014,
2.67399251314,
2.3533660741399998,
2.76679924414,
2.34361865814,
2.54754726514,
2.44639710914,
2.71735432514,
2.6804996701399997,
2.45259485214
]
},
{
"command": "pnpr@HEAD",
"mean": 1.51756928024,
"stddev": 0.13888089443638174,
"median": 1.48807252264,
"user": 1.1946933999999998,
"system": 1.1477083199999998,
"min": 1.36804001114,
"max": 1.75267112714,
"times": [
1.44969406014,
1.37827975314,
1.54397950914,
1.36804001114,
1.75267112714,
1.57336757014,
1.52645098514,
1.4007251171400001,
1.73881061814,
1.4436740511400001
]
},
{
"command": "pnpr@main",
"mean": 1.52046697064,
"stddev": 0.13504562204074597,
"median": 1.53424912414,
"user": 1.2267725,
"system": 1.1084204199999999,
"min": 1.35298649314,
"max": 1.78166435914,
"times": [
1.37460222814,
1.53073373614,
1.5991268521400002,
1.6454805301400002,
1.78166435914,
1.54803206214,
1.35298649314,
1.45069697114,
1.53776451214,
1.38358196214
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.2596807668,
"stddev": 0.008645772805398199,
"median": 0.2597274794,
"user": 0.1979859,
"system": 0.5265691800000001,
"min": 0.2492786894,
"max": 0.2728528524,
"times": [
0.27108940140000004,
0.2728528524,
0.25729135740000003,
0.2656697504,
0.2492823284,
0.26325206440000004,
0.2492786894,
0.2539693344,
0.2621636014,
0.2519582884
]
},
{
"command": "pacquet@main",
"mean": 0.25479580929999995,
"stddev": 0.007622286596930377,
"median": 0.25269099940000006,
"user": 0.20828149999999995,
"system": 0.50306038,
"min": 0.2463018694,
"max": 0.2698866244,
"times": [
0.2508469964,
0.24640055940000002,
0.2698866244,
0.2525234394,
0.2590018274,
0.2648502904,
0.25274868640000003,
0.25263331240000003,
0.2463018694,
0.2527644874
]
},
{
"command": "pnpr@HEAD",
"mean": 0.2694944811,
"stddev": 0.008764549876845466,
"median": 0.27067555790000003,
"user": 0.21621859999999993,
"system": 0.50470988,
"min": 0.2583238754,
"max": 0.2804623624,
"times": [
0.2804623624,
0.2583238754,
0.2635706404,
0.2790452244,
0.27747651240000004,
0.27364647940000003,
0.26770463640000003,
0.2756083134,
0.2601800104,
0.2589267564
]
},
{
"command": "pnpr@main",
"mean": 0.27076132710000006,
"stddev": 0.004097261602657831,
"median": 0.2696812809,
"user": 0.20521060000000002,
"system": 0.50890388,
"min": 0.26542766840000004,
"max": 0.2769160774,
"times": [
0.26542766840000004,
0.2733993344,
0.2661770624,
0.26802856540000003,
0.2769160774,
0.2730785234,
0.2684473464,
0.2767761314,
0.2694790684,
0.2698834934
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.5818789319599995,
"stddev": 0.00978350724578702,
"median": 2.58308392896,
"user": 1.6404804199999998,
"system": 1.37022806,
"min": 2.56398265296,
"max": 2.5949291959600003,
"times": [
2.5949291959600003,
2.5908456989600004,
2.58661541296,
2.58969269796,
2.5681824139600002,
2.58208899096,
2.57917954196,
2.58407886696,
2.57919384696,
2.56398265296
]
},
{
"command": "pacquet@main",
"mean": 2.57736650816,
"stddev": 0.010294049879074885,
"median": 2.5754868984600003,
"user": 1.6675727199999997,
"system": 1.3303821599999999,
"min": 2.5639769499600003,
"max": 2.5959648959600004,
"times": [
2.57163753796,
2.58067693296,
2.57612539996,
2.58203715396,
2.59138298596,
2.5959648959600004,
2.5694079529600002,
2.56760687496,
2.5639769499600003,
2.5748483969600002
]
},
{
"command": "pnpr@HEAD",
"mean": 1.67463060826,
"stddev": 0.14453650878321647,
"median": 1.68810308546,
"user": 1.17201252,
"system": 1.1670014600000003,
"min": 1.4289292389600001,
"max": 1.85626660996,
"times": [
1.7985421869600002,
1.8241318399600002,
1.64405985496,
1.4289292389600001,
1.6430757769600002,
1.69655726496,
1.4472823729600002,
1.6796489059600002,
1.72781203096,
1.85626660996
]
},
{
"command": "pnpr@main",
"mean": 1.6287899634600003,
"stddev": 0.11365012597054645,
"median": 1.60725221896,
"user": 1.16655042,
"system": 1.1647272599999998,
"min": 1.4596068099600001,
"max": 1.8328987959600003,
"times": [
1.4596068099600001,
1.6821647469600003,
1.4865852109600002,
1.59373034096,
1.8328987959600003,
1.58854910596,
1.6953196379600002,
1.5833419279600003,
1.7449289609600003,
1.62077409696
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.42595457334,
"stddev": 0.01219930624628448,
"median": 0.42201105274,
"user": 0.5214425199999999,
"system": 0.6914732800000001,
"min": 0.40968550924,
"max": 0.45322006124,
"times": [
0.43882330524,
0.42191562024,
0.41753045124,
0.41987771324,
0.45322006124,
0.42202318324,
0.42912260424,
0.42534836324,
0.40968550924,
0.42199892224
]
},
{
"command": "pacquet@main",
"mean": 0.40759618594,
"stddev": 0.017508179697452456,
"median": 0.40718042624,
"user": 0.49755781999999993,
"system": 0.67471278,
"min": 0.38245620624,
"max": 0.44016156424,
"times": [
0.44016156424,
0.40335428924,
0.38245620624,
0.39115205524,
0.40484740624,
0.38961993824,
0.40951344624,
0.42381014324,
0.41028172324,
0.42076508724
]
},
{
"command": "pnpr@HEAD",
"mean": 0.30074357304,
"stddev": 0.009042399033697206,
"median": 0.29942653874,
"user": 0.19090622,
"system": 0.5052694799999999,
"min": 0.29106102223999997,
"max": 0.31890501024,
"times": [
0.29166051324,
0.31120773124,
0.29964525424,
0.29373438124,
0.29106102223999997,
0.30141577824,
0.30607639524,
0.29452182124,
0.31890501024,
0.29920782324
]
},
{
"command": "pnpr@main",
"mean": 0.30143685034,
"stddev": 0.00725762101688631,
"median": 0.29935498924,
"user": 0.18237022000000003,
"system": 0.5175647800000001,
"min": 0.29132393724,
"max": 0.31228273423999997,
"times": [
0.30092150223999997,
0.30584431124,
0.29572440224,
0.29636565224,
0.29132393724,
0.31228273423999997,
0.29552508924,
0.30782741324,
0.29778847624,
0.31076498524
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.7279947228799997,
"stddev": 0.005486458656346673,
"median": 1.7270251734800002,
"user": 0.75832708,
"system": 0.78007118,
"min": 1.71680986498,
"max": 1.73635653498,
"times": [
1.7342048539800001,
1.72544310998,
1.7312078139800002,
1.72516707998,
1.72609862398,
1.7267214909800002,
1.7273288559800002,
1.73635653498,
1.73060899998,
1.71680986498
]
},
{
"command": "pacquet@main",
"mean": 1.7195961754800002,
"stddev": 0.008301477277182426,
"median": 1.71999359548,
"user": 0.7601427799999999,
"system": 0.7511593799999999,
"min": 1.70589421798,
"max": 1.73553356498,
"times": [
1.71815619098,
1.73553356498,
1.70589421798,
1.72556747898,
1.71373120698,
1.72183099998,
1.72402940798,
1.7166080039800002,
1.7117247579800001,
1.72288592498
]
},
{
"command": "pnpr@HEAD",
"mean": 0.30267835538000004,
"stddev": 0.003952200149766266,
"median": 0.30243475598,
"user": 0.18162407999999997,
"system": 0.51786808,
"min": 0.29690969798,
"max": 0.30937044798,
"times": [
0.30547096998,
0.30100384498,
0.30605448898,
0.29821951798,
0.30003106798,
0.29690969798,
0.30047007798,
0.30937044798,
0.30538777298,
0.30386566698
]
},
{
"command": "pnpr@main",
"mean": 0.30196655678,
"stddev": 0.008626029970315956,
"median": 0.29971377398,
"user": 0.16982177999999998,
"system": 0.52567878,
"min": 0.29450886798,
"max": 0.32359165198,
"times": [
0.30494582798000003,
0.30582235598,
0.29690909198,
0.29450886798,
0.30165330298,
0.29612583598000003,
0.30301634898,
0.29531803898000003,
0.29777424498,
0.32359165198
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.23424047431636366,
"stddev": 0.01997919616136013,
"median": 0.23702685768000004,
"user": 0.1649777727272727,
"system": 0.0862891818181818,
"min": 0.20247808868000003,
"max": 0.25900615368,
"times": [
0.25188330768,
0.25416328968,
0.21838021168000002,
0.25900615368,
0.20247808868000003,
0.25135995168,
0.21152488568000002,
0.23702685768000004,
0.22208674568000003,
0.21944850068000002,
0.24928722468000003
]
},
{
"command": "pacquet@main",
"mean": 0.22820117791076924,
"stddev": 0.011496227244060915,
"median": 0.22795034968000003,
"user": 0.16497111538461537,
"system": 0.0812663076923077,
"min": 0.21556505868000003,
"max": 0.25073248668000003,
"times": [
0.21583491268000002,
0.23752174768000003,
0.22795034968000003,
0.23024606968000003,
0.24448706668000003,
0.21556505868000003,
0.21804925968000002,
0.22548350168000003,
0.23634524368000004,
0.22948329468000003,
0.21769651168000004,
0.25073248668000003,
0.21721980968000001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.08914786516484852,
"stddev": 0.0027788623642940333,
"median": 0.08868928268000001,
"user": 0.020783348484848488,
"system": 0.01137890909090909,
"min": 0.08581909568,
"max": 0.09905894168,
"times": [
0.08581909568,
0.08643584368,
0.08643954168000001,
0.08731530168,
0.08601043968000001,
0.08699818368000001,
0.08743991068,
0.08687979668,
0.08630334068,
0.08739535868000001,
0.09069727368000001,
0.08764229268,
0.09283900368,
0.09905894168,
0.08929907568,
0.09100016768000001,
0.08827106468,
0.09145139468,
0.08892573068000001,
0.08868928268000001,
0.09086628868,
0.09243282968000001,
0.09161925868000001,
0.08901337568,
0.09071638368,
0.08726460068,
0.09106221668,
0.09266885868000001,
0.08623387568,
0.09076514668,
0.08827749768,
0.08893235568,
0.08711582168
]
},
{
"command": "pnpr@main",
"mean": 0.09046632955096774,
"stddev": 0.0032070874358151383,
"median": 0.09047748868000001,
"user": 0.02108779032258065,
"system": 0.012475903225806452,
"min": 0.08510287868000001,
"max": 0.09763329668000001,
"times": [
0.08983049568,
0.08613544868,
0.08691736668,
0.08695412968,
0.09047748868000001,
0.08774406568,
0.08981383768000001,
0.09175958768,
0.09142005568,
0.08661274368,
0.08510287868000001,
0.08634817168,
0.08693361268000001,
0.09172124568000001,
0.09114765468000001,
0.09180784868,
0.09763329668000001,
0.09368076468,
0.09031229868,
0.09119976668,
0.09193553568,
0.08892443268,
0.09603503968,
0.09222905268,
0.09133362168,
0.08971837368,
0.08773318368000001,
0.09523861068,
0.08824878268,
0.09598058368000001,
0.09352624068
]
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.7403921344,
"stddev": 0.1781424362591088,
"median": 0.6555448314,
"user": 0.6766465355555555,
"system": 0.15146476444444443,
"min": 0.5599092304,
"max": 1.0800682534000001,
"times": [
0.5912157294,
0.8921854444,
0.5599092304,
0.6201284554000001,
0.9112912284,
1.0800682534000001,
0.7050490854,
0.6555448314,
0.6481369514
]
},
{
"command": "pacquet@main",
"mean": 0.7706495777333333,
"stddev": 0.21822069278077535,
"median": 0.7323375024000001,
"user": 0.7124693133333334,
"system": 0.15504865333333331,
"min": 0.5218930934,
"max": 1.1337181764000002,
"times": [
0.7323375024000001,
1.1337181764000002,
1.1189727084,
0.6456518354,
0.5218930934,
0.5669498854,
0.7829630604,
0.7428686334,
0.6904913044000001
]
},
{
"command": "pnpm@HEAD",
"mean": 3.050985459844445,
"stddev": 0.19169019656539615,
"median": 2.9282265254000004,
"user": 4.315049202222222,
"system": 0.306011431111111,
"min": 2.8699255144,
"max": 3.3183374024,
"times": [
2.8699255144,
2.9005721264,
3.2286625514000002,
2.8837532894,
2.9282265254000004,
3.3183374024,
3.1267597834000003,
3.3033847024000003,
2.8992472434
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.492093687900001,
"stddev": 0.13535788108136296,
"median": 4.443292101999999,
"user": 1.8593794600000002,
"system": 1.4445896,
"min": 4.4226558475,
"max": 4.8670801825,
"times": [
4.4571055274999996,
4.4310614435,
4.508295534499999,
4.4227155545,
4.4261558265,
4.4992827585,
4.454947864499999,
4.4226558475,
4.4316363395,
4.8670801825
]
},
{
"command": "pacquet@main",
"mean": 4.565750817799999,
"stddev": 0.1319862166224547,
"median": 4.574719013999999,
"user": 1.8723732600000003,
"system": 1.3918403,
"min": 4.4142877105,
"max": 4.7797681105,
"times": [
4.7797681105,
4.4142877105,
4.6509028435,
4.5746579794999995,
4.6523897325,
4.709769243499999,
4.4298635845,
4.4373757685,
4.4337131565,
4.574780048499999
]
},
{
"command": "pnpr@HEAD",
"mean": 3.541947906,
"stddev": 0.08236236843393557,
"median": 3.5305198035,
"user": 1.32478836,
"system": 1.2112958,
"min": 3.4583086805,
"max": 3.6953778965,
"times": [
3.5192377805,
3.5437660245,
3.4714134645,
3.5418018265,
3.6953778965,
3.5523539195000002,
3.4703250315000003,
3.4930617535,
3.6738326825,
3.4583086805
]
},
{
"command": "pnpr@main",
"mean": 3.560965735000001,
"stddev": 0.12345233556014687,
"median": 3.5237147235,
"user": 1.3093808599999999,
"system": 1.2385766999999999,
"min": 3.4497645355,
"max": 3.8631723175,
"times": [
3.5195971215,
3.4497645355,
3.4787872945,
3.5278323255,
3.5663458935,
3.8631723175,
3.6261764605,
3.4626813835,
3.6281628425,
3.4871371755
]
}
]
} |
|
| Project | pnpm's project |
| Branch | pr/13728 |
| 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,428.93 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 296.91 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 291.06 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 85.82 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,368.04 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,458.31 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 258.32 ms |
…ry comparison URL-equivalent spellings of the canonical npm registry (case variants, an explicit :443) must not be misclassified as non-canonical, or the fail-closed policy for the canonical registry would be bypassable through ordinary user configuration. Both stacks now normalize through URL parsing and share one comparison rule; the TS stack reuses the equalRegistries helper from `@pnpm/deps.security.signatures`. Also adds the direct TypeScript regression coverage for stripRegistryTarballUrls that review asked for: mirror-hosted registry tarballs persist integrity-only, while file:, git-hosted, and subdirectory tarballs keep their URLs. Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
|
Re the Qodo review:
Written by an agent (Claude Code, claude-fable-5). |
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
`@pnpm11/installing/env-installer/test/resolvePackageManagerIntegrities.test.ts`:
- Around line 90-92: Update the resolution assertions in
resolvePackageManagerIntegrities to compare complete objects for git-hosted-dep
and subdir-dep, using their exact original tarball URLs and integrity values
rather than expect.any(String). Preserve the existing local-dep assertion and
ensure the expected values retain opaque URLs without normalization.
🪄 Autofix
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: 39751623-a2da-4535-b9cb-8225d9b2fda6
📒 Files selected for processing (6)
pnpm/crates/cli/src/cli_args/self_update/verify_engine.rspnpm/crates/cli/src/cli_args/self_update/verify_engine/tests.rspnpm11/deps/security/signatures/src/verifySignatures.tspnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.tspnpm11/engine/pm/commands/test/self-updater/verifyPnpmEngineIdentity.test.tspnpm11/installing/env-installer/test/resolvePackageManagerIntegrities.test.ts
🚧 Files skipped from review as they are similar to previous changes (5)
- pnpm11/engine/pm/commands/test/self-updater/verifyPnpmEngineIdentity.test.ts
- pnpm11/engine/pm/commands/src/self-updater/verifyPnpmEngineIdentity.ts
- pnpm/crates/cli/src/cli_args/self_update/verify_engine.rs
- pnpm/crates/cli/src/cli_args/self_update/verify_engine/tests.rs
- pnpm11/deps/security/signatures/src/verifySignatures.ts
Co-Authored-By: Claude Fable 5 <[email protected]>
|
Code review by qodo was updated up to the latest commit 00b5342 |
…#75) ## Why the pin existed `mise.toml` pinned pnpm not as a convenience but because **the `packageManager` field could not be satisfied here at all**. pnpm refused to switch to a version it could not verify, and the 1ES proxy publishes no npm registry signatures — no `dist.signatures`, no `/-/npm/v1/keys`, no attestations, only a SHA-1 `shasum`. Keeping the pinned version already on PATH meant no switch was ever attempted. ## That constraint is gone pnpm 11.21.0 lifted it. [pnpm/pnpm#13728](pnpm/pnpm#13728) fixed both halves **against this exact proxy** — Microsoft filed it, and the PR names the shasum-only case directly. Package-manager entries are now recorded integrity-only (the bootstrap always derives the download URL from the trusted registries rather than from the lockfile), and the engine signature falls back to registry.npmjs.org when the configured registry cannot provide one. Demonstrated both ways against this repo's `.npmrc`, in a scratch project pinning a different pnpm: ``` 11.17.0 [ERROR] The packageManager dependency "[email protected]" in pnpm-lock.yaml must use a registry package path and an integrity-only resolution 11.25.0 switches and reports 11.23.0 ``` The two versions stay equal anyway — a switch that works is still a download nobody asked for — but the comment no longer asserts a constraint that has been fixed. ## What this does *not* fix **The lockfile tarball hosts.** Different code path, different constraint: an ordinary `--frozen-lockfile` install fetches the recorded URL *without resolving*, so pnpm cannot drop a URL it is unable to reconstruct — a frozen install would have nothing to fetch. Ours is unreconstructible on the host alone (`ms-feed-N.pkgs.visualstudio.com` vs the registry host), so it is kept. That asymmetry is why #13728 could drop the URL for the bootstrap and not here. `scripts/strip-lockfile-hosts.mjs` stays. Worth recording that it rests on solid ground — the registry-derived URL genuinely resolves: ``` https://packagefeedproxy.microsoft.io/npm/wrappy/-/wrappy-1.0.2.tgz → 303 → signed blob → 1676 bytes, sha1 b5243d8f… (matches the advertised shasum) ``` The one supported alternative, `trustLockfile`, is **worse on both axes**: it keeps the URLs (so every install still churns ~1700 lines) *and* gives up the anti-tamper binding that [#12134](pnpm/pnpm#12134) added. Stripping leaves no URL to tamper with at all. ## Verification - Lockfile **byte-identical** under 11.25.0; format version unchanged at `9.0`. - `verify:workspace` passes (14 assertions). - Container suite **15/15**, with `pnpm v11.25.0` inside. - `mise.lock` carries the `linux-x64` and `linux-arm64` checksums the Docker build reads (`scripts/docker-test.mjs` cross-checks it against `packageManager`). ## One transition cost For anyone not on mise: **a local pnpm older than 11.21.0 now fails on entry to this repo**, because it tries to switch to 11.25.0 and hits the very bug above. `mise install` resolves it. CI is unaffected — `pnpm/action-setup` installs the pinned version directly and never switches. ## Do not jump to pnpm 12 It is the Rust rewrite, and there is an open issue about it refusing integrity-less tarball resolutions — which is exactly what this shasum-only proxy serves.
Summary
Unblocks the automatic
packageManagerversion switch (andpnpm self-update) behind private mirrors and feed proxies, while keeping the bootstrap-hardening guarantees of #12296 and #12292 intact. This is the pair of regressions reported by Microsoft in discussion 3787, which currently blocks >200 monorepos / >4k engineers there.Closes #13619. Closes #13147.
What changes (both stacks):
tarballURL in the resolution, which the strict env-lockfile validation then rejected. The advertised URL is now dropped at resolution time: the bootstrap never fetches a lockfile-recorded URL anyway (the URL is always derived from the trusted bootstrap registries), so the entries land in exactly the integrity-only shape the validation accepts. The validation itself is unchanged — still maximally strict.dist.signatures(or only a stale/broken one), the signature is fetched from registry.npmjs.org and verified against the same embedded npm keys over the installed integrity. Where the signature bytes come from does not change what they prove, so this is exactly as strong as today's check, and it also rides out mirrors caching signatures from rotated-out keys.shasum(a sha1 pin no npm signature can ever cover — Microsoft's proxy does both), the switch proceeds with a warning only when the engine resolves through a non-canonical registry, which can only come from the user's own trusted (non-project) configuration. The canonical-registry comparison normalizes through URL parsing, so URL-equivalent spellings (https://Registry.NPMJS.org:443/) cannot sidestep the fail-closed policy.Why this stays secure (the properties #12296 / #12292 established):
Verified end to end against the registry from the report (
packagefeedproxy.microsoft.io, publicly readable): both the legacypackageManagerpath and the persistingdevEnginespath now switch successfully, and the persisted entries are integrity-only.Notes / known gaps:
SilentReporter(pacquet), so it is not visible there; it is visible onpnpm self-updateandpnpm with. This mirrors the pre-existing handling of other bootstrap-time warnings in both stacks and could be improved in a follow-up.Squash Commit Body
Checklist
already linked to it solves it.
pnpm/port.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-fable-5).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit
New Features
Bug Fixes