Skip to content

fix(self-update): accept an unclean TLS close in the signature check - #17765

Merged
zkochan merged 2 commits into
mainfrom
fix-17763
Nov 6, 2026
Merged

zkochan merged 2 commits into
mainfrom
fix-17763

Conversation

@zkochan

@zkochan zkochan commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #17763.

pnpm self-update behind a TLS-intercepting proxy failed with ERR_PNPM_PNPM_ENGINE_IDENTITY_UNVERIFIABLE ... https://registry.npmjs.org/pnpm: error decoding response body. The cause is the same as in #16704. The proxy sends the packument with no Content-Length and no chunked framing, then ends it by closing the connection without a TLS close_notify alert. #16708 made the resolver's metadata reads accept that close, which is why the version resolution in the report succeeded. The engine signature check reads npm's packument through its own capped body loop, and that loop still failed on the close.

pnpm_network now has read_limited_self_delimiting_body, which puts the size cap of read_limited_body on the tolerant read of read_self_delimiting_body. The signature check uses it. A framed body cut short by the close still fails, and a cut-short unframed body fails the JSON parse.

pnpm v11 is unaffected because Node.js treats the close as the end of the body.

I could not reproduce this behind the reporter's proxy. The new unclean_tls_close tests use a local rustls server that closes without close_notify. When read_limited_self_delimiting_body is changed back to the framed behavior, the close-delimited test fails.

Squash Commit Body

The engine signature check read npm's packument through its own body
loop. A TLS-intercepting proxy that sends the packument with neither
Content-Length nor chunked framing and closes the connection without a
close_notify alert made rustls report an error there, so `pnpm
self-update` failed with ERR_PNPM_PNPM_ENGINE_IDENTITY_UNVERIFIABLE.

pnpm/pnpm#16708 fixed the same close for the resolver's metadata reads.
`read_limited_self_delimiting_body` adds the size cap this
trust-critical path needs to that tolerant read, and the signature
check uses it. A framed body cut short by the close still fails.

Closes pnpm/pnpm#17763

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • New features are implemented only in the Rust pnpm v12 CLI. Bug fixes
    are implemented in every affected version.
  • Added a changeset.
  • Added or updated tests.

Written by an agent (Claude Code, claude-opus-5-5).

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • Bug Fixes
    • pnpm self-update and switching to the version specified by packageManager now work with proxies that close TLS connections without a close_notify alert.
    • Registry signature verification can handle these proxy connections without failing when the response body is close-delimited.
    • Responses larger than the supported size limit are still rejected. Responses with a declared length that end prematurely also remain errors.

The engine signature check read npm's packument through its own body
loop. A TLS-intercepting proxy that sends the packument with neither
Content-Length nor chunked framing and closes the connection without a
close_notify alert made rustls report an error there, so `pnpm
self-update` failed with ERR_PNPM_PNPM_ENGINE_IDENTITY_UNVERIFIABLE.

#16708 fixed the same close for the resolver's metadata reads.
`read_limited_self_delimiting_body` adds the size cap this
trust-critical path needs to that tolerant read, and the signature
check uses it. A framed body cut short by the close still fails.

Closes #17763

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Self-update now reads registry packuments with a limited body reader that supports close-delimited responses ending with an unclean TLS close. Framed responses still report premature closure, and truncated packments are rejected.

Changes: Registry signature reads

Layer / File(s) Summary
Limited network body reading
pnpm/crates/network/src/limited_body.rs, pnpm/crates/network/src/lib.rs, pnpm/crates/network/src/tests/unclean_tls_close.rs
The network crate adds a limited self-delimiting body reader. Tests cover complete and truncated close-delimited bodies, and errors for incomplete Content-Length responses.
Self-update packument reading
pnpm/crates/cli/src/cli_args/self_update/verify_engine/signatures.rs, .changeset/self-update-unclean-tls-close.md
Self-update uses the limited reader for packuments up to 50 MiB, reports read errors, and rejects truncated bodies. The changeset records the affected update scenario.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Assessment against linked issues

Objective Addressed Explanation
Allow pnpm self-update to verify the registry signature when a proxy closes a close-delimited TLS response without close_notify ([#17763]) ✅

Suggested labels: product: pacquet

Merge Risk: Low · up to 1ecd7

In a narrow proxy failure scenario, self-update can be blocked unnecessarily. The change is otherwise mergeable with awareness of this limitation.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 82fc2ea and 1ecd7b6.

Files selected for processing: 1

  • pnpm/crates/cli/src/cli_args/self_update/verify_engine/signatures.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     16.5±2.04ms    22.7 MB/sec    1.02     16.9±1.87ms    22.2 MB/sec
packument/parse                                  1.11     51.3±8.20µs  1291.9 MB/sec    1.00     46.4±3.22µs  1430.7 MB/sec
tarball/download_dependency                      1.00  981.3±212.38µs     4.3 MB/sec    1.07  1054.9±184.96µs     4.0 MB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00   239.1±13.43ms 66.9 KElem/sec    1.03    245.7±9.25ms 65.1 KElem/sec
version_pick/repeated_ranges_file                1.03      5.1±0.16ms  6.1 KElem/sec    1.00      4.9±0.07ms  6.3 KElem/sec
version_pick/repeated_ranges_raw                 1.10      5.3±0.27ms  5.8 KElem/sec    1.00      4.9±0.08ms  6.4 KElem/sec
version_pick/wildcard_lowest                     1.00     41.3±1.95µs 23.6 KElem/sec    1.00     41.1±0.71µs 23.7 KElem/sec
workspace_resolution/hoist_heavy                 1.03   331.0±22.80ms        ? ?/sec    1.00   321.4±10.98ms        ? ?/sec
workspace_sort/chained_projects                  1.08     18.0±4.08ms        ? ?/sec    1.00     16.7±2.24ms        ? ?/sec

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Same-run regression check

HEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval.

Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.

Scenario Engine main median HEAD median Change Tolerance Result
isolated-fresh-restore-cold-cache-cold-store pacquet 2796.65 ms 2802.63 ms 0.2% 139.83 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1557.27 ms 1643.77 ms 5.6% 77.86 ms Inconclusive (overlapping samples)
isolated-fresh-restore-hot-cache-hot-store pacquet 321.93 ms 361.32 ms 12.2% 16.10 ms Inconclusive (overlapping samples)
isolated-fresh-restore-hot-cache-hot-store pnpr 407.36 ms 317.04 ms -22.2% 20.37 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 12.15 ms 11.45 ms -5.7% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 10.83 ms 11.37 ms 4.9% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 9.47 ms 9.91 ms 4.7% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 9.28 ms 9.35 ms 0.8% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2546.86 ms 2608.50 ms 2.4% 127.34 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1566.03 ms 1637.82 ms 4.6% 78.30 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 444.09 ms 450.31 ms 1.4% 22.20 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 286.55 ms 276.87 ms -3.4% 14.33 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1638.98 ms 1642.41 ms 0.2% 81.95 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 298.51 ms 295.51 ms -1.0% 14.93 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 297.11 ms 295.02 ms -0.7% 14.86 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr 98.87 ms 102.92 ms 4.1% 4.94 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 241.56 ms 253.83 ms 5.1% 12.08 ms Inconclusive (overlapping samples)
isolated-linked-workspace-resolve-hot-cache-offline pacquet 84.93 ms 92.49 ms 8.9% 4.25 ms Inconclusive (overlapping samples)
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet 97.75 ms 103.34 ms 5.7% 4.89 ms Inconclusive (overlapping samples)
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4644.87 ms 4796.58 ms 3.3% 232.24 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3623.03 ms 3594.44 ms -0.8% 181.15 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 149.54 ms 150.97 ms 1.0% 7.48 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 189.83 ms 178.58 ms -5.9% 9.49 ms Within tolerance
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet 1270.56 ms 1241.17 ms -2.3% 63.53 ms Within tolerance
cargo-repeat-install-hot-cache-hot-store pacquet 36.62 ms 32.48 ms -11.3% 2.00 ms Within tolerance

Same-run syscall check

Each install runs 2 more times per revision, untimed, under strace --follow-forks --summary-only. A file syscall regresses when HEAD's fewest calls exceed main's most by more than 2% of main or 50 calls, whichever is larger. mkdir and mkdirat count only the calls that created a directory, since concurrent installs fail a varying number with EEXIST. A syscall whose identical runs differ by more than that tolerance is reported unstable and not gated, unless HEAD's fewest calls also exceed main's most by more than the tolerance plus that difference. Each scenario lists its largest change relative to its tolerance and every row that is not within tolerance.

Scenario Engine Syscall main calls (max) HEAD calls (min) Change Tolerance Identical-run spread Result
isolated-fresh-restore-cold-cache-cold-store pacquet symlink 3892 3894 +0.1% 77 5 Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet readlink 15274 15286 +0.1% 305 14 Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr access 11 11 +0.0% 50 0 Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet access 8 8 +0.0% 50 0 Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr access 8 8 +0.0% 50 0 Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet access 8 8 +0.0% 50 0 Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr access 8 8 +0.0% 50 0 Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet readlink 16850 16572 -1.6% 337 671 Unstable (identical runs differ by 671, not gated)
isolated-fresh-install-cold-cache-cold-store pnpr readlink 15276 15330 +0.4% 305 1 Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet statx 52351 52400 +0.1% 1047 44 Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet access 8 8 +0.0% 50 0 Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr access 8 8 +0.0% 50 0 Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet access 8 8 +0.0% 50 0 Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet access 8 8 +0.0% 50 0 Within tolerance
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet access 11 11 +0.0% 50 0 Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr readlink 15267 15281 +0.1% 305 27 Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet access 11 11 +0.0% 50 0 Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr symlink 1151 1161 +0.9% 50 0 Within tolerance
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet access 8 8 +0.0% 50 0 Within tolerance
cargo-repeat-install-hot-cache-hot-store pacquet access 22 22 +0.0% 50 0 Within tolerance

Integrated-Benchmark Report (Linux)

Commit: 1ecd7b684c47

Compared against main at: 9f8c6bd5f2f4

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked, injected, and Cargo workspace scenarios compare current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs.

Scenario: Isolated linker: fresh restore, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.805 ± 0.068 2.691 2.903 1.76 ± 0.15
pacquet@main 2.799 ± 0.058 2.672 2.874 1.76 ± 0.15
pnpr@HEAD 1.608 ± 0.142 1.436 1.828 1.01 ± 0.12
pnpr@main 1.592 ± 0.128 1.427 1.800 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.80493839438,
      "stddev": 0.06789538397310471,
      "median": 2.80263356698,
      "user": 3.0278175,
      "system": 2.0205081999999996,
      "min": 2.69119693748,
      "max": 2.90293509648
    },
    {
      "command": "pacquet@main",
      "mean": 2.79946875818,
      "stddev": 0.05796237700057965,
      "median": 2.79665369548,
      "user": 3.0049535999999994,
      "system": 1.9938379999999996,
      "min": 2.67151767748,
      "max": 2.87370500948
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6082034531800002,
      "stddev": 0.14224042934535858,
      "median": 1.6437706679800002,
      "user": 2.5125728,
      "system": 1.8631718,
      "min": 1.43628184248,
      "max": 1.82845676848
    },
    {
      "command": "pnpr@main",
      "mean": 1.59156963358,
      "stddev": 0.12838744137237734,
      "median": 1.55727163798,
      "user": 2.5112821,
      "system": 1.6934404,
      "min": 1.4266282134800001,
      "max": 1.8001843454800002
    }
  ]
}

Scenario: Isolated linker: fresh restore, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 362.7 ± 48.1 268.9 445.8 1.16 ± 0.19
pacquet@main 329.6 ± 28.0 293.4 391.6 1.05 ± 0.14
pnpr@HEAD 313.7 ± 31.8 270.3 359.7 1.00
pnpr@main 399.4 ± 50.9 322.2 498.4 1.27 ± 0.21
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.36268493772000004,
      "stddev": 0.04810659169769155,
      "median": 0.36131842032000006,
      "user": 0.41449825999999995,
      "system": 0.7598653200000001,
      "min": 0.26887106432,
      "max": 0.44576044032000006
    },
    {
      "command": "pacquet@main",
      "mean": 0.32957177862000003,
      "stddev": 0.02801614792802183,
      "median": 0.3219282588200001,
      "user": 0.36551906000000006,
      "system": 0.73658952,
      "min": 0.29343209032000006,
      "max": 0.39162428132000004
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.31366636802,
      "stddev": 0.03179433928608513,
      "median": 0.31704236732,
      "user": 0.35554096,
      "system": 0.67451382,
      "min": 0.27032800132000007,
      "max": 0.35968466232000007
    },
    {
      "command": "pnpr@main",
      "mean": 0.3994000789200001,
      "stddev": 0.05088527174376576,
      "median": 0.4073582223200001,
      "user": 0.44027965999999996,
      "system": 0.8227946200000001,
      "min": 0.32217726732000007,
      "max": 0.49839903432000005
    }
  ]
}

Scenario: Isolated linker: repeat install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 11.7 ± 1.5 9.5 18.9 1.07 ± 0.17
pacquet@main 12.3 ± 1.7 9.3 17.2 1.13 ± 0.20
pnpr@HEAD 11.5 ± 1.3 9.1 15.6 1.06 ± 0.16
pnpr@main 10.9 ± 1.1 8.8 14.3 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.011660144835714287,
      "stddev": 0.001478833474412268,
      "median": 0.0114531168,
      "user": 0.006576649795918368,
      "system": 0.006064582857142854,
      "min": 0.009521632300000001,
      "max": 0.0188619823
    },
    {
      "command": "pacquet@main",
      "mean": 0.012269432390476207,
      "stddev": 0.0017426539383894374,
      "median": 0.0121471323,
      "user": 0.007534417142857141,
      "system": 0.005929008571428569,
      "min": 0.0092765113,
      "max": 0.0171929623
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.011509662457446808,
      "stddev": 0.001289327466080188,
      "median": 0.0113678023,
      "user": 0.006640608936170217,
      "system": 0.005978901617021273,
      "min": 0.0090865713,
      "max": 0.0155869323
    },
    {
      "command": "pnpr@main",
      "mean": 0.010892715164754097,
      "stddev": 0.001090927283464264,
      "median": 0.0108339618,
      "user": 0.00647942229508197,
      "system": 0.005434096393442627,
      "min": 0.0088309513,
      "max": 0.014293341300000002
    }
  ]
}

Scenario: Isolated linker: repeat install, cold cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 10.0 ± 0.6 9.1 14.8 1.07 ± 0.09
pacquet@main 9.5 ± 0.4 8.8 12.2 1.02 ± 0.08
pnpr@HEAD 9.4 ± 0.4 8.6 11.3 1.00 ± 0.07
pnpr@main 9.3 ± 0.6 8.4 15.2 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.009961163055714286,
      "stddev": 0.0005821089446368388,
      "median": 0.009914236520000001,
      "user": 0.005190445714285714,
      "system": 0.005798581785714287,
      "min": 0.00908141652,
      "max": 0.01484440652
    },
    {
      "command": "pacquet@main",
      "mean": 0.00951120808170213,
      "stddev": 0.0004390092813799439,
      "median": 0.00947082852,
      "user": 0.005342377021276595,
      "system": 0.005216506553191489,
      "min": 0.00876612652,
      "max": 0.01220984152
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.009372746148318588,
      "stddev": 0.00036189979556882734,
      "median": 0.009351894520000001,
      "user": 0.005589013982300887,
      "system": 0.004805293539823005,
      "min": 0.008601072520000001,
      "max": 0.01130471452
    },
    {
      "command": "pnpr@main",
      "mean": 0.00934142132786026,
      "stddev": 0.000589511298236475,
      "median": 0.00927704352,
      "user": 0.00552162218340611,
      "system": 0.0048425809606986924,
      "min": 0.00837503452,
      "max": 0.015247014520000001
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.612 ± 0.062 2.495 2.693 1.66 ± 0.16
pacquet@main 2.555 ± 0.044 2.483 2.620 1.62 ± 0.16
pnpr@HEAD 1.644 ± 0.084 1.474 1.768 1.04 ± 0.11
pnpr@main 1.578 ± 0.149 1.404 1.817 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.6116776476800005,
      "stddev": 0.06216433666000672,
      "median": 2.60850356278,
      "user": 2.69855022,
      "system": 1.6615082600000002,
      "min": 2.49544418378,
      "max": 2.69335135778
    },
    {
      "command": "pacquet@main",
      "mean": 2.55463173138,
      "stddev": 0.0438089511458962,
      "median": 2.54686275128,
      "user": 2.42564882,
      "system": 1.61763926,
      "min": 2.4827560117800003,
      "max": 2.62047420078
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6444791894799997,
      "stddev": 0.08421820698204788,
      "median": 1.63782061178,
      "user": 2.02362872,
      "system": 1.49627016,
      "min": 1.47440389078,
      "max": 1.76791716378
    },
    {
      "command": "pnpr@main",
      "mean": 1.57776386438,
      "stddev": 0.14945386631571173,
      "median": 1.5660282322799999,
      "user": 1.97890262,
      "system": 1.4566438599999998,
      "min": 1.40389801578,
      "max": 1.81679530278
    }
  ]
}

Scenario: Isolated linker: fresh install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 447.9 ± 13.4 426.2 466.8 1.60 ± 0.08
pacquet@main 447.1 ± 9.6 432.0 463.3 1.60 ± 0.07
pnpr@HEAD 279.2 ± 11.1 266.8 300.1 1.00
pnpr@main 296.2 ± 26.1 272.3 360.4 1.06 ± 0.10
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.44791200974,
      "stddev": 0.013376547605027139,
      "median": 0.45031169134000004,
      "user": 0.62897118,
      "system": 0.9049130600000002,
      "min": 0.42617473884,
      "max": 0.46680233584
    },
    {
      "command": "pacquet@main",
      "mean": 0.44711235843999997,
      "stddev": 0.009556074905762896,
      "median": 0.44409094434000007,
      "user": 0.6184807799999998,
      "system": 0.9152243600000001,
      "min": 0.43203792484000003,
      "max": 0.46325718284000006
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.2792192083400001,
      "stddev": 0.011135432695065775,
      "median": 0.27686587784000005,
      "user": 0.23115027999999999,
      "system": 0.5444091600000001,
      "min": 0.26676948584000004,
      "max": 0.30013042584000005
    },
    {
      "command": "pnpr@main",
      "mean": 0.29624631194,
      "stddev": 0.026100255400869556,
      "median": 0.28654834484,
      "user": 0.27279218,
      "system": 0.5673615599999999,
      "min": 0.27233819184,
      "max": 0.36035084384000005
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.644 ± 0.013 1.626 1.665 5.55 ± 0.10
pacquet@main 1.635 ± 0.019 1.597 1.662 5.53 ± 0.11
pnpr@HEAD 0.296 ± 0.005 0.289 0.304 1.00
pnpr@main 0.302 ± 0.015 0.287 0.338 1.02 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.64359096542,
      "stddev": 0.012799600571484843,
      "median": 1.6424098635200002,
      "user": 0.91499884,
      "system": 0.8410070199999999,
      "min": 1.6260299955200002,
      "max": 1.6649134205200002
    },
    {
      "command": "pacquet@main",
      "mean": 1.6354236231200001,
      "stddev": 0.01880240728704345,
      "median": 1.6389766565200001,
      "user": 0.8763059400000002,
      "system": 0.86341292,
      "min": 1.5970771395200003,
      "max": 1.66214328652
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29595162981999995,
      "stddev": 0.004620834538931495,
      "median": 0.29550540202,
      "user": 0.26696344,
      "system": 0.56885832,
      "min": 0.28943869552,
      "max": 0.30396601752
    },
    {
      "command": "pnpr@main",
      "mean": 0.30213018052,
      "stddev": 0.01456491685417918,
      "median": 0.29850522852,
      "user": 0.28925693999999996,
      "system": 0.5706207200000001,
      "min": 0.28661395652,
      "max": 0.33837699752
    }
  ]
}

Scenario: Isolated linker: fresh resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 301.5 ± 18.1 283.5 336.1 3.06 ± 0.23
pacquet@main 300.5 ± 13.3 283.5 322.8 3.05 ± 0.20
pnpr@HEAD 101.8 ± 4.7 93.1 109.1 1.03 ± 0.07
pnpr@main 98.4 ± 4.7 90.2 108.9 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.30152423961999997,
      "stddev": 0.018078029100229483,
      "median": 0.29502238912,
      "user": 0.31504074000000004,
      "system": 0.3595242799999999,
      "min": 0.28354103262,
      "max": 0.33611870262
    },
    {
      "command": "pacquet@main",
      "mean": 0.30048648982000004,
      "stddev": 0.013266503601060489,
      "median": 0.29711016462,
      "user": 0.30686884,
      "system": 0.38239478,
      "min": 0.28349528762000004,
      "max": 0.32281450462
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.10178523417172415,
      "stddev": 0.0047406141264999,
      "median": 0.10292051062000002,
      "user": 0.04427636413793103,
      "system": 0.031022576551724138,
      "min": 0.09309568262000001,
      "max": 0.10907018762000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.09842298112000002,
      "stddev": 0.004672101346523435,
      "median": 0.09887493312000001,
      "user": 0.039254104285714284,
      "system": 0.03117328714285714,
      "min": 0.09015996562000002,
      "max": 0.10894474262
    }
  ]
}

Scenario: Isolated linker: peer-heavy resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 247.1 ± 14.4 228.0 266.0 1.00
pacquet@main 247.9 ± 18.8 228.9 286.7 1.00 ± 0.10
pnpm@HEAD 4674.8 ± 297.9 4323.3 5330.1 18.92 ± 1.63
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.24712733959777783,
      "stddev": 0.014419781500919954,
      "median": 0.25383185982,
      "user": 0.2907719177777778,
      "system": 0.04141176888888889,
      "min": 0.22804137282000003,
      "max": 0.26602912182000005
    },
    {
      "command": "pacquet@main",
      "mean": 0.24786782804222224,
      "stddev": 0.018846782072261956,
      "median": 0.24155837882000003,
      "user": 0.2740283622222222,
      "system": 0.04579810222222222,
      "min": 0.22886344482,
      "max": 0.28667528382
    },
    {
      "command": "pnpm@HEAD",
      "mean": 4.674811688375556,
      "stddev": 0.2978877023171929,
      "median": 4.58862386782,
      "user": 7.302195139999999,
      "system": 0.41083888,
      "min": 4.323323551820001,
      "max": 5.330110585820001
    }
  ]
}

Scenario: Isolated linker: linked-workspace resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 93.3 ± 5.8 84.4 102.6 1.06 ± 0.10
pacquet@main 88.2 ± 6.8 81.7 102.7 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.09327399177500001,
      "stddev": 0.005750408702346452,
      "median": 0.0924920269,
      "user": 0.083941425,
      "system": 0.0527077225,
      "min": 0.0844032494,
      "max": 0.1025674064
    },
    {
      "command": "pacquet@main",
      "mean": 0.08818764296666666,
      "stddev": 0.006773071131202449,
      "median": 0.08493318990000001,
      "user": 0.0822423,
      "system": 0.047644826666666674,
      "min": 0.0816732674,
      "max": 0.10273851640000001
    }
  ]
}

Scenario: Isolated linker: injected workspace repeat install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 105.4 ± 6.9 93.4 122.1 1.05 ± 0.11
pacquet@main 100.3 ± 8.5 88.7 124.3 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.10537614379076922,
      "stddev": 0.006896269153083652,
      "median": 0.10333914806,
      "user": 0.03922548307692307,
      "system": 0.07496519846153846,
      "min": 0.09342403906,
      "max": 0.12212441906
    },
    {
      "command": "pacquet@main",
      "mean": 0.10030172168962961,
      "stddev": 0.0085394133784312,
      "median": 0.09774910506000001,
      "user": 0.03664650444444445,
      "system": 0.07138995629629628,
      "min": 0.08871068306,
      "max": 0.12426339206
    }
  ]
}

Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.822 ± 0.179 4.619 5.146 1.34 ± 0.05
pacquet@main 4.688 ± 0.178 4.534 5.151 1.30 ± 0.05
pnpr@HEAD 3.602 ± 0.052 3.531 3.692 1.00
pnpr@main 3.653 ± 0.128 3.541 3.910 1.01 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.821546211799999,
      "stddev": 0.17914212126098344,
      "median": 4.7965840672999995,
      "user": 2.7299903799999994,
      "system": 1.8074434199999998,
      "min": 4.6192455023,
      "max": 5.1460389433
    },
    {
      "command": "pacquet@main",
      "mean": 4.6880708354,
      "stddev": 0.17798301123972854,
      "median": 4.6448699193,
      "user": 2.64478498,
      "system": 1.7657010199999998,
      "min": 4.5339524933,
      "max": 5.1510195442999995
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.6016321383999994,
      "stddev": 0.05245587219917416,
      "median": 3.5944447533,
      "user": 2.12421008,
      "system": 1.5669779199999998,
      "min": 3.5312291062999996,
      "max": 3.6920973192999997
    },
    {
      "command": "pnpr@main",
      "mean": 3.653122809,
      "stddev": 0.12847274046165344,
      "median": 3.6230317892999997,
      "user": 2.0957189799999996,
      "system": 1.51692302,
      "min": 3.5408050083,
      "max": 3.9098843693
    }
  ]
}

Scenario: GVS linker: fresh restore, hot cache + hot store

Same install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 151.0 ± 6.6 141.0 167.9 1.04 ± 0.10
pacquet@main 144.8 ± 12.5 125.0 171.8 1.00
pnpr@HEAD 179.3 ± 17.4 156.1 224.4 1.24 ± 0.16
pnpr@main 189.9 ± 9.0 173.9 211.6 1.31 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.15098887875411762,
      "stddev": 0.006598193214893845,
      "median": 0.15097013946,
      "user": 0.18399976588235292,
      "system": 0.15075376117647057,
      "min": 0.14099088346,
      "max": 0.16789965546000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.14477635781294118,
      "stddev": 0.012490772972815414,
      "median": 0.14953790046,
      "user": 0.17630788352941174,
      "system": 0.13461493764705884,
      "min": 0.12504648046,
      "max": 0.17175397746
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.17934803071000005,
      "stddev": 0.01740885263637928,
      "median": 0.17858179696,
      "user": 0.213465935,
      "system": 0.15503857000000001,
      "min": 0.15613353146,
      "max": 0.22435180046
    },
    {
      "command": "pnpr@main",
      "mean": 0.18985490987666667,
      "stddev": 0.008971638830705004,
      "median": 0.18982539896,
      "user": 0.22304964333333333,
      "system": 0.16216340333333332,
      "min": 0.17392657146,
      "max": 0.21164274346
    }
  ]
}

Scenario: Store only: unlocked direct deps, cold cache + hot store

Store-only install (enableModulesDir: false, per-file store index, trusted lockfile) against a lockfile missing the direct dependencies that have peers, with the metadata cache wiped per iteration: the install resolves those from the registry, reuses their subtrees from the lockfile and checks the store, linking nothing. Direct installs only.

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.237 ± 0.061 1.155 1.310 1.00
pacquet@main 1.260 ± 0.050 1.171 1.329 1.02 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.2374576629,
      "stddev": 0.06138225169845708,
      "median": 1.2411650032,
      "user": 0.51054712,
      "system": 0.23697132,
      "min": 1.1548461392,
      "max": 1.3095712072
    },
    {
      "command": "pacquet@main",
      "mean": 1.2604589256000003,
      "stddev": 0.0497631091709523,
      "median": 1.2705555767,
      "user": 0.5389302199999999,
      "system": 0.25883222,
      "min": 1.1706018582,
      "max": 1.3291170832
    }
  ]
}

Scenario: Cargo: repeat install, hot cache + hot store

Frozen repeat install of a Cargo workspace (cargo.enabled: true) whose crates are already materialized in <storeDir>/v11/crates/ and linked into .pnpm/crates/crates-io. Direct installs only.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 32.9 ± 3.2 28.6 44.9 1.00
pacquet@main 35.8 ± 3.3 27.5 40.7 1.09 ± 0.15
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.03286106813142856,
      "stddev": 0.00324916267014234,
      "median": 0.03248032456,
      "user": 0.023344206530612244,
      "system": 0.01845410612244898,
      "min": 0.02860468206,
      "max": 0.04490423506
    },
    {
      "command": "pacquet@main",
      "mean": 0.035804778490232565,
      "stddev": 0.0032647475628842966,
      "median": 0.036621373060000004,
      "user": 0.02592161255813952,
      "system": 0.019498346511627906,
      "min": 0.02754527906,
      "max": 0.040721396060000005
    }
  ]
}

@codecov-commenter

codecov-commenter commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.22222% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.99%. Comparing base (7242501) to head (1ecd7b6).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...c/cli_args/self_update/verify_engine/signatures.rs 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17765      +/-   ##
==========================================
+ Coverage   92.96%   92.99%   +0.02%     
==========================================
  Files        2119     2123       +4     
  Lines      272471   272841     +370     
==========================================
+ Hits       253297   253721     +424     
+ Misses      19174    19120      -54     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zkochan
zkochan marked this pull request as ready for review November 5, 2026 23:57
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Accept unclean TLS closes during self-update signature checks

🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Allow unframed registry packuments to end at an unclean TLS close during signature verification.
• Retain the 50 MiB body cap and reject incomplete framed responses.
• Add local TLS tests for close-delimited bodies, size limits, and truncated framed bodies.
Diagram

graph TD
  A["Registry packument"] --> F{"HTTP framing?"} -->|yes| G["Framed read"] --> B["Capped body"] --> P["Parse JSON"] --> V["Verify signature"]
  F -->|no| T["Close-tolerant read"] --> B
  G -->|short body| E["Reject response"]
  B -->|oversize| E
  P -->|invalid JSON| E
Loading
High-Level Assessment

Extending the shared network reader is appropriate: it reuses the existing unclean-close detection while preserving bounded reads and strict handling of framed responses. A signature-specific loop would duplicate those rules.

Files changed (5) +106 / -35

Bug fix (3) +59 / -29
signatures.rsUse a capped, close-tolerant packument reader +8/-19

Use a capped, close-tolerant packument reader

• Replaces the signature check’s body loop with the shared reader. It retains the 50 MiB limit and rejects bodies marked truncated.

pnpm/crates/cli/src/cli_args/self_update/verify_engine/signatures.rs

lib.rsExport the new network body reader +4/-1

Export the new network body reader

• Makes the capped, self-delimiting body reader available to the CLI.

pnpm/crates/network/src/lib.rs

limited_body.rsShare capped reads with framing-aware TLS close handling +47/-9

Share capped reads with framing-aware TLS close handling

• Adds a capped reader that accepts an unclean TLS close only when the response lacks body framing. Refactors the existing capped and self-delimiting readers to share the relevant read logic.

pnpm/crates/network/src/limited_body.rs

Tests (1) +42 / -6
unclean_tls_close.rsTest capped reads against unclean TLS closes +42/-6

Test capped reads against unclean TLS closes

• Adds local rustls-server tests confirming acceptance of an unframed close, truncation at the size limit, and failure for a cut-short Content-Length body.

pnpm/crates/network/src/tests/unclean_tls_close.rs

Documentation (1) +5 / -0
self-update-unclean-tls-close.mdDocument the self-update proxy fix +5/-0

Document the self-update proxy fix

• Adds a pacquet patch changeset describing the signature-check failure and the affected self-update and packageManager version-switching flows.

.changeset/self-update-unclean-tls-close.md

@qodo-code-review

qodo-code-review Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Self-update reads known-oversized bodies ✓ Resolved

Resolving commit: 1ecd7b6

Resolution reason
Adds an early check at the top of read_bounded_body: if response.content_length() exceeds
MAX_PACKUMENT_BYTES, it returns the oversized-packument error immediately, before any body read via
read_limited_self_delimiting_body. This matches the suggested fix; the streaming cap remains for
responses without a usable declared length.
Description
read_bounded_body now delegates before checking Content-Length, while read_capped_body records
an oversized header but still reads and copies chunks. When a registry advertises a packument over
50 MiB, self-update can download up to the cap before rejecting a response it previously rejected
without reading its body.

Grey Divider

Context sources
⚠️ Tickets: not configured — No jira, linear integration is connected for the linked tickets
✅ Compliance rules (platform): 60 rules
✅ Cross-repo context — repo relationships
  Explored: repo: pnpm/update (sha: 2457663d) — View relationship
  Explored: repo: pnpm/setup (sha: 42a113bc) — View relationship
  Explored: repo: pnpm/action-setup (sha: 5eea8caf) — View relationship
Review mode: Auto: ⚖️ Balanced: Small early-reject check, but it sits in supply-chain signature verification, a security-sensitive path.
✅ Fix-loop round: fix loop

Grey Divider

Tip of the day
💡 Did you know, you can switch off images and animations for a plain-text comment

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 1ecd7b6

Results up to commit 82fc2ea ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. Self-update reads known-oversized bodies ✓ Resolved

Resolving commit: 1ecd7b6

Resolution reason
Adds an early check at the top of read_bounded_body: if response.content_length() exceeds
MAX_PACKUMENT_BYTES, it returns the oversized-packument error immediately, before any body read via
read_limited_self_delimiting_body. This matches the suggested fix; the streaming cap remains for
responses without a usable declared length.
Description
read_bounded_body now delegates before checking Content-Length, while read_capped_body records
an oversized header but still reads and copies chunks. When a registry advertises a packument over
50 MiB, self-update can download up to the cap before rejecting a response it previously rejected
without reading its body.

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@greptile-apps

greptile-apps Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous finding is fully addressed.

Reviews (2) · Last reviewed commit: "fix(self-update): reject an oversized pa..." · Reviewed by Greptile

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Nov 6, 2026
@zkochan

zkochan commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

Qodo finding 1 (self-update reads known-oversized bodies) is the same as the Greptile thread. Fixed in 1ecd7b6, which restores the early Content-Length check.


Written by an agent (Claude Code, claude-opus-5-5).

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 1ecd7b6

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@zkochan
zkochan merged commit 2849366 into main Nov 6, 2026
65 checks passed
@zkochan
zkochan deleted the fix-17763 branch November 6, 2026 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Errors reading pnpm's own registry signature during self-update

2 participants