Skip to content

fix(setup): declare the module type in the manifest written for a standalone executable - #13732

Merged
zkochan merged 2 commits into
mainfrom
npx-install
Aug 9, 2026
Merged

zkochan merged 2 commits into
mainfrom
npx-install

Conversation

@zkochan

@zkochan zkochan commented Aug 8, 2026 •

Copy link
Copy Markdown
Member

Summary

pnpm setup writes a package.json next to a standalone executable that ships without one — the tarball get.pnpm.io/install.sh downloads — so the global install has a package to install. That manifest omitted "type": "module", so Node.js reparsed the ESM files shipped beside the executable (dist/worker.js) as CommonJS first and printed a MODULE_TYPELESS_PACKAGE_JSON warning on every pnpm invocation:

(node:2620375) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///…/dist/worker.js
is not specified and it doesn't parse as CommonJS. Reparsing as ES module because module syntax
was detected. This incurs a performance overhead.

The published @pnpm/exe manifest already declares the module type, so this only affected installs made through the standalone script — which is the install path pnpm.io recommends first.

Found while building an npx-runnable installer on this branch. That installer has since moved to pnpm/get.pnpm.io#51, where it sits beside install.sh and install.ps1 and shares their pinned npm signing key; it is published as get-pnpm and now used by pnpm/setup. This PR is only the CLI fix that came out of it.

Squash Commit Body

`pnpm setup` writes a package.json next to a standalone executable whose
directory has none — the tarball that https://get.pnpm.io/install.sh
downloads — so the global install has a package to install. That
manifest omitted `"type": "module"`, so Node.js reparsed the ESM files
shipped beside the executable (`dist/worker.js`) as CommonJS first and
printed a MODULE_TYPELESS_PACKAGE_JSON warning on every spawn.

The published `@pnpm/exe` manifest already declares the module type, so
this only affected installs made through the standalone script.

Fixed in both stacks. The manifest construction moves into
`standaloneManifest` / `standalone_manifest`, so it can be asserted
without running the global install the surrounding function performs.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.
  • Updated the documentation if needed.

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

@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a0c37d2e-e560-4cf3-902d-ed1e45213e90

📥 Commits

Reviewing files that changed from the base of the PR and between 21178e6 and 3ace631.

📒 Files selected for processing (1)
  • cspell.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • cspell.json

📝 Walkthrough

Walkthrough

Standalone executable setup now uses reusable manifest helpers in Rust and pnpm11. The generated adjacent package.json files declare "type": "module" and retain package metadata and pnpm/pn binary mappings. Tests and release metadata cover the change.

Changes

Standalone executable manifests

Layer / File(s) Summary
Manifest generation and setup validation
pnpm/crates/cli/src/cli_args/setup.rs, pnpm/crates/cli/src/cli_args/setup/tests.rs, pnpm11/engine/pm/commands/src/setup/setup.ts, pnpm11/engine/pm/commands/test/setup/setup.test.ts, .changeset/setup-writes-module-type.md, cspell.json
Rust and pnpm11 setup use reusable manifest helpers. The manifests include the package name, pnpm version, "type": "module", and pnpm/pn executable aliases. Tests verify the generated metadata. The changeset and spelling dictionary support the update.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: product: pacquet, product: pnpm@11

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch npx-install

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

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.04     12.0±0.04ms    31.3 MB/sec    1.00     11.5±0.03ms    32.7 MB/sec
packument/parse                                  1.00     39.4±0.15µs  1685.3 MB/sec    1.00     39.4±0.06µs  1683.3 MB/sec
tarball/download_dependency                      1.00      2.4±0.07ms  1831.9 KB/sec    1.00      2.4±0.07ms  1822.8 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    172.2±1.95ms 92.9 KElem/sec    1.00    172.7±1.56ms 92.6 KElem/sec
workspace_resolution/hoist_heavy                 1.00    244.6±0.82ms        ? ?/sec    1.01    246.6±1.23ms        ? ?/sec

@codecov-commenter

codecov-commenter commented Aug 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.09%. Comparing base (8a453e3) to head (3ace631).

Files with missing lines Patch % Lines
pnpm/crates/cli/src/cli_args/setup.rs 87.50% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13732   +/-   ##
=======================================
  Coverage   88.09%   88.09%           
=======================================
  Files         621      621           
  Lines      101071   101074    +3     
=======================================
+ Hits        89039    89045    +6     
+ Misses      12032    12029    -3     

☔ 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.

@github-actions

github-actions Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 3ace6314d28d

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.499 ± 0.125 2.357 2.693 1.70 ± 0.19
pacquet@main 2.437 ± 0.130 2.334 2.742 1.66 ± 0.19
pnpr@HEAD 1.472 ± 0.145 1.355 1.746 1.00
pnpr@main 1.542 ± 0.178 1.345 1.797 1.05 ± 0.16
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.49882026104,
      "stddev": 0.12451684425598013,
      "median": 2.45728403654,
      "user": 1.5549797200000002,
      "system": 1.28756548,
      "min": 2.35675291154,
      "max": 2.69312349754,
      "times": [
        2.69312349754,
        2.40920664854,
        2.62236081854,
        2.66815733254,
        2.49443427654,
        2.35675291154,
        2.42013379654,
        2.41348364954,
        2.3766947305399997,
        2.53385494854
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.43664436954,
      "stddev": 0.13026329256100996,
      "median": 2.4002727665399997,
      "user": 1.5078681200000001,
      "system": 1.2936608800000002,
      "min": 2.33429819454,
      "max": 2.74202257254,
      "times": [
        2.4091468255399997,
        2.34114233754,
        2.45402887954,
        2.33429819454,
        2.39139870754,
        2.58086697254,
        2.74202257254,
        2.3384268855399997,
        2.41488617954,
        2.36022614054
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.47210273484,
      "stddev": 0.14478253888367343,
      "median": 1.38433457954,
      "user": 1.0219997200000002,
      "system": 1.12681348,
      "min": 1.35451536854,
      "max": 1.74647130454,
      "times": [
        1.5659436545399998,
        1.5327414365399998,
        1.3774423465399999,
        1.35451536854,
        1.37962561554,
        1.74647130454,
        1.35723649154,
        1.6618774585399998,
        1.38904354354,
        1.3561301285399998
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5417636427399999,
      "stddev": 0.17787001788061954,
      "median": 1.54656363004,
      "user": 1.0511700200000003,
      "system": 1.11800568,
      "min": 1.34537051554,
      "max": 1.7968672795399998,
      "times": [
        1.74917581654,
        1.36858083554,
        1.75452062654,
        1.3752407015399999,
        1.7968672795399998,
        1.54722176354,
        1.5768533215399998,
        1.34537051554,
        1.54590549654,
        1.35790007054
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 258.1 ± 6.4 248.9 266.0 1.00
pacquet@main 258.8 ± 4.1 252.4 266.1 1.00 ± 0.03
pnpr@HEAD 263.1 ± 8.7 251.7 276.0 1.02 ± 0.04
pnpr@main 274.6 ± 7.0 266.6 290.1 1.06 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25806325592000007,
      "stddev": 0.006351818090005206,
      "median": 0.25876877092,
      "user": 0.20249469999999997,
      "system": 0.5297317999999999,
      "min": 0.24891611542,
      "max": 0.26597114842,
      "times": [
        0.26038483242,
        0.26114927242,
        0.26488443242,
        0.25715270942,
        0.26520023642,
        0.26597114842,
        0.25073349542,
        0.25386323642,
        0.24891611542,
        0.25237708042
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.25881110842,
      "stddev": 0.004117310245158791,
      "median": 0.25763477542,
      "user": 0.2139728,
      "system": 0.5348609,
      "min": 0.25244634042,
      "max": 0.26608736842,
      "times": [
        0.25683017242,
        0.25244634042,
        0.26071602642,
        0.25828941842,
        0.26295102342,
        0.26608736842,
        0.25478430042,
        0.25690559442,
        0.25698013242,
        0.26212070742
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.26310094182000004,
      "stddev": 0.00865909339666489,
      "median": 0.26164104842,
      "user": 0.21059409999999995,
      "system": 0.5036805999999998,
      "min": 0.25165103242000003,
      "max": 0.27603073042,
      "times": [
        0.25165103242000003,
        0.25742537542,
        0.25520821042,
        0.26596469542,
        0.27603073042,
        0.27175124142,
        0.25616513242,
        0.25735406142,
        0.26585672142,
        0.27360221742
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.27463616412,
      "stddev": 0.007004238383662995,
      "median": 0.27503030642000004,
      "user": 0.2124746,
      "system": 0.5320614,
      "min": 0.26657841042,
      "max": 0.29010665542,
      "times": [
        0.29010665542,
        0.27072635142,
        0.27588277142,
        0.27744607542,
        0.27715545842,
        0.27417784142,
        0.26657841042,
        0.26920272242,
        0.26672503742000003,
        0.27836031742
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.590 ± 0.013 2.575 2.617 1.55 ± 0.14
pacquet@main 2.598 ± 0.022 2.568 2.638 1.56 ± 0.14
pnpr@HEAD 1.670 ± 0.149 1.440 1.825 1.00
pnpr@main 1.678 ± 0.131 1.434 1.821 1.00 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.58965980836,
      "stddev": 0.013249407722988734,
      "median": 2.58422951056,
      "user": 1.51595798,
      "system": 1.3130678400000002,
      "min": 2.57470146456,
      "max": 2.61658627856,
      "times": [
        2.58493431656,
        2.58063055556,
        2.59077976056,
        2.58048822756,
        2.58050402756,
        2.57470146456,
        2.60375735956,
        2.61658627856,
        2.58352470456,
        2.60069138856
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.59827056436,
      "stddev": 0.02197209508092441,
      "median": 2.59766393906,
      "user": 1.46452178,
      "system": 1.33799374,
      "min": 2.5681009705599998,
      "max": 2.63758258256,
      "times": [
        2.57472680256,
        2.62662661856,
        2.63758258256,
        2.60653681156,
        2.60274479356,
        2.5681009705599998,
        2.60018219956,
        2.59514567856,
        2.57830085056,
        2.59275833556
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6696839224599997,
      "stddev": 0.1487364566392309,
      "median": 1.7239304515599998,
      "user": 1.02047268,
      "system": 1.13691394,
      "min": 1.4399266765599998,
      "max": 1.82485535256,
      "times": [
        1.82485535256,
        1.5503216015599999,
        1.79278614456,
        1.46014148756,
        1.4399266765599998,
        1.58082057256,
        1.74252188756,
        1.7849668855599998,
        1.70533901556,
        1.81515960056
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.6775055821599998,
      "stddev": 0.1308097221161275,
      "median": 1.7122265895599997,
      "user": 1.03574338,
      "system": 1.11509854,
      "min": 1.43389018956,
      "max": 1.8210324355599998,
      "times": [
        1.8210324355599998,
        1.8044980015599998,
        1.79952176356,
        1.63785516556,
        1.61566329956,
        1.7376226845599998,
        1.5005191025599998,
        1.70015989556,
        1.43389018956,
        1.7242932835599998
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 417.4 ± 15.3 404.0 446.5 1.36 ± 0.06
pacquet@main 416.9 ± 12.5 398.6 433.5 1.36 ± 0.06
pnpr@HEAD 306.1 ± 8.6 290.9 320.0 1.00
pnpr@main 306.3 ± 6.8 296.9 315.4 1.00 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.41744126108,
      "stddev": 0.015347146103789993,
      "median": 0.41390531888000004,
      "user": 0.5216339000000001,
      "system": 0.7040580000000001,
      "min": 0.40403950288,
      "max": 0.44651460788,
      "times": [
        0.41085447088000004,
        0.44188999188,
        0.42048278588000004,
        0.40482907888,
        0.40403950288,
        0.41695616688000003,
        0.44651460788,
        0.40538601788,
        0.41784153288000003,
        0.40561845488000003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.4168531592800001,
      "stddev": 0.012513904126481477,
      "median": 0.41503309738000005,
      "user": 0.5289211,
      "system": 0.6740027000000002,
      "min": 0.39860541488,
      "max": 0.43354495388000003,
      "times": [
        0.43196511988,
        0.41804712088,
        0.39860541488,
        0.40905037488,
        0.41432245988000005,
        0.41116904288,
        0.43354495388000003,
        0.41574373488000005,
        0.43327871288,
        0.40280465788
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30609638418,
      "stddev": 0.008611956958172257,
      "median": 0.30778118138,
      "user": 0.20091740000000002,
      "system": 0.526927,
      "min": 0.29092041788,
      "max": 0.32000874388,
      "times": [
        0.30594080188,
        0.29620424488,
        0.29981305688000004,
        0.31150006688000004,
        0.29092041788,
        0.30384816388,
        0.30962156088000004,
        0.32000874388,
        0.31167720988000003,
        0.31142957488
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30629712088,
      "stddev": 0.006782367239850866,
      "median": 0.30435379488000003,
      "user": 0.1931386,
      "system": 0.5292504,
      "min": 0.29691206688,
      "max": 0.31539177288000003,
      "times": [
        0.31539177288000003,
        0.31161123588,
        0.30488399288,
        0.30166329088000005,
        0.30379271788,
        0.31530457788,
        0.29691206688,
        0.30382359688,
        0.29795804488,
        0.31162991188
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.736 ± 0.013 1.720 1.756 5.77 ± 0.13
pacquet@main 1.722 ± 0.010 1.710 1.742 5.72 ± 0.13
pnpr@HEAD 0.301 ± 0.007 0.290 0.309 1.00
pnpr@main 0.305 ± 0.007 0.295 0.315 1.01 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.7362836442200003,
      "stddev": 0.01256834177151546,
      "median": 1.7338903216200001,
      "user": 0.76108098,
      "system": 0.7842764599999998,
      "min": 1.7204865336200001,
      "max": 1.75591829962,
      "times": [
        1.74510826362,
        1.73549083262,
        1.75591829962,
        1.72353836862,
        1.7386081446200001,
        1.7263409436200001,
        1.7204865336200001,
        1.73228981062,
        1.7293467616200002,
        1.75570848362
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.7224553201200004,
      "stddev": 0.010375328595672936,
      "median": 1.7230073591200001,
      "user": 0.7377047800000001,
      "system": 0.7417729599999999,
      "min": 1.7096979146200002,
      "max": 1.74191113162,
      "times": [
        1.74191113162,
        1.72904765762,
        1.72396861862,
        1.7220460996200002,
        1.7295376806200002,
        1.7096979146200002,
        1.71292446862,
        1.71046473862,
        1.71551833062,
        1.7294365606200002
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30097615152,
      "stddev": 0.006635196128097438,
      "median": 0.30236734862000003,
      "user": 0.19103078,
      "system": 0.51328506,
      "min": 0.29036701862,
      "max": 0.30890308062,
      "times": [
        0.30618603662,
        0.30821550661999997,
        0.29384698062,
        0.29036701862,
        0.29990089562,
        0.30184006662,
        0.29266183862,
        0.30890308062,
        0.30289463062,
        0.30494546062
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30503495102,
      "stddev": 0.00681859648357653,
      "median": 0.30235175962,
      "user": 0.19026778,
      "system": 0.53126316,
      "min": 0.29527402562,
      "max": 0.31489298662,
      "times": [
        0.30019777461999997,
        0.29527402562,
        0.31489298662,
        0.30731749662,
        0.30319196162,
        0.30088286461999997,
        0.31441477562,
        0.30029264362,
        0.31237342362,
        0.30151155762
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 240.7 ± 12.3 214.4 255.6 2.76 ± 0.15
pacquet@main 220.5 ± 20.1 188.1 255.8 2.53 ± 0.23
pnpr@HEAD 87.4 ± 1.5 84.3 90.5 1.00 ± 0.02
pnpr@main 87.3 ± 1.4 84.7 91.4 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.24071282991666673,
      "stddev": 0.012268260600644697,
      "median": 0.23926352500000003,
      "user": 0.17072819333333333,
      "system": 0.06808799666666666,
      "min": 0.21436628750000003,
      "max": 0.2556040075,
      "times": [
        0.23610989350000003,
        0.23095839850000002,
        0.2556040075,
        0.25518747350000004,
        0.24562217850000004,
        0.23662233950000003,
        0.25379580350000003,
        0.25059066150000003,
        0.21436628750000003,
        0.23116986550000002,
        0.24138896150000003,
        0.23713808850000004
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.22051643856666664,
      "stddev": 0.02010570951814567,
      "median": 0.21770492050000004,
      "user": 0.16901992666666665,
      "system": 0.07253667999999999,
      "min": 0.1880870115,
      "max": 0.25584222650000005,
      "times": [
        0.19590622950000003,
        0.22604081250000002,
        0.21770492050000004,
        0.21817270250000004,
        0.25584222650000005,
        0.21474016950000002,
        0.22691074950000004,
        0.23494977950000004,
        0.25580161050000005,
        0.1880870115,
        0.21309507450000004,
        0.24189470250000003,
        0.21138780150000003,
        0.20084589750000004,
        0.20636689050000004
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08744568573529411,
      "stddev": 0.0015473633192662705,
      "median": 0.08736643250000001,
      "user": 0.02073297764705882,
      "system": 0.009232928235294119,
      "min": 0.08429708150000001,
      "max": 0.0905452415,
      "times": [
        0.08429708150000001,
        0.0873913035,
        0.0874613675,
        0.0895584135,
        0.0854650485,
        0.0873415615,
        0.08709850250000001,
        0.0867583225,
        0.08828018850000001,
        0.0863613765,
        0.0892886065,
        0.0869284045,
        0.08655293650000001,
        0.0868149505,
        0.0876473965,
        0.08985775750000001,
        0.0873940705,
        0.0847113005,
        0.0898514765,
        0.08620944950000001,
        0.08805523450000001,
        0.0876054485,
        0.0864154875,
        0.0855632145,
        0.0905452415,
        0.0858484405,
        0.08727412450000001,
        0.0879500755,
        0.0895236995,
        0.0899082325,
        0.08730865850000001,
        0.0884865675,
        0.0878569515,
        0.0855424235
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08729739115625,
      "stddev": 0.0014319304165686354,
      "median": 0.08720172300000001,
      "user": 0.02204311,
      "system": 0.007490796250000001,
      "min": 0.08474284950000001,
      "max": 0.0913853825,
      "times": [
        0.0875224405,
        0.0874123545,
        0.08549619850000001,
        0.08582400450000001,
        0.0913853825,
        0.0854388495,
        0.08677280150000001,
        0.0872016085,
        0.0863749815,
        0.0879063545,
        0.0872018375,
        0.08809333550000001,
        0.0871802675,
        0.0872807565,
        0.08783853650000001,
        0.0872797255,
        0.08582070850000001,
        0.0896604165,
        0.0866340585,
        0.0858822545,
        0.0871508025,
        0.08807809750000001,
        0.0881850795,
        0.0860404725,
        0.08712697650000001,
        0.0902598945,
        0.0871766405,
        0.08787410350000001,
        0.08474284950000001,
        0.0890110135,
        0.0855653185,
        0.08809839550000001
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 806.9 ± 154.1 647.0 1155.6 1.13 ± 0.27
pacquet@main 716.2 ± 106.2 613.1 910.9 1.00
pnpm@HEAD 2870.8 ± 66.5 2807.6 3038.5 4.01 ± 0.60
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.8068817763666668,
      "stddev": 0.15406673209847394,
      "median": 0.7571577837000001,
      "user": 0.7444740266666667,
      "system": 0.13460369333333333,
      "min": 0.6470234607,
      "max": 1.1556029387,
      "times": [
        0.8307941877000001,
        1.1556029387,
        0.7395045457000001,
        0.8459088287000001,
        0.6470234607,
        0.8832622477000001,
        0.7538413017000001,
        0.6488406927000001,
        0.7571577837000001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.7161827948111112,
      "stddev": 0.10623790778459302,
      "median": 0.6958618787,
      "user": 0.6651402488888889,
      "system": 0.11970269333333333,
      "min": 0.6131005787,
      "max": 0.9109070327000001,
      "times": [
        0.6958618787,
        0.7630978247000001,
        0.6560515847,
        0.6131005787,
        0.6979461607,
        0.6278765607000001,
        0.8548899037000001,
        0.9109070327000001,
        0.6259136287000001
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 2.870788353255556,
      "stddev": 0.06652258625376671,
      "median": 2.8550789166999997,
      "user": 4.40506136,
      "system": 0.28062369333333337,
      "min": 2.8075630876999997,
      "max": 3.0384957807,
      "times": [
        2.8877349647,
        2.8550789166999997,
        2.8523005077,
        2.8583688587,
        2.8075630876999997,
        2.8308886447,
        2.8581995207,
        3.0384957807,
        2.8484648977
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.514 ± 0.140 4.390 4.867 1.28 ± 0.06
pacquet@main 4.574 ± 0.212 4.419 4.963 1.30 ± 0.07
pnpr@HEAD 3.518 ± 0.110 3.443 3.803 1.00
pnpr@main 3.551 ± 0.136 3.438 3.824 1.01 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.5141338847400005,
      "stddev": 0.13970115987423656,
      "median": 4.482691985240001,
      "user": 1.6630096199999997,
      "system": 1.36856062,
      "min": 4.38979380874,
      "max": 4.86696751074,
      "times": [
        4.53298532974,
        4.47525155874,
        4.86696751074,
        4.43192959474,
        4.56674274074,
        4.40060797174,
        4.49013241174,
        4.42280789174,
        4.38979380874,
        4.564120028740001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.57351097154,
      "stddev": 0.21237324742146046,
      "median": 4.46225299124,
      "user": 1.73380892,
      "system": 1.44121512,
      "min": 4.41869967774,
      "max": 4.96316824074,
      "times": [
        4.45352934174,
        4.75671170774,
        4.96316824074,
        4.47097664074,
        4.41869967774,
        4.42105617574,
        4.48727851274,
        4.89363198574,
        4.42665566074,
        4.4434017717400005
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5180134670400003,
      "stddev": 0.11044678419209958,
      "median": 3.47534023474,
      "user": 1.1582634200000002,
      "system": 1.2047804199999996,
      "min": 3.44319324174,
      "max": 3.80256555974,
      "times": [
        3.46708235574,
        3.55145334774,
        3.80256555974,
        3.47986409474,
        3.48006275974,
        3.47081637474,
        3.45155639074,
        3.4461889877400003,
        3.44319324174,
        3.58735155774
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.5514968760400003,
      "stddev": 0.1363212329300106,
      "median": 3.48487596124,
      "user": 1.1700598199999999,
      "system": 1.2293174199999999,
      "min": 3.43753843174,
      "max": 3.8237550857400002,
      "times": [
        3.8237550857400002,
        3.45237345574,
        3.43753843174,
        3.54709964074,
        3.46397663674,
        3.48428887174,
        3.48546305074,
        3.44074688074,
        3.72987684674,
        3.64984985974
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13732
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,574.70 ms
(-3.34%)Baseline: 2,663.70 ms
3,196.44 ms
(80.55%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,720.49 ms
(-2.71%)Baseline: 1,768.32 ms
2,121.99 ms
(81.08%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
404.04 ms
(-10.00%)Baseline: 448.91 ms
538.70 ms
(75.00%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
214.37 ms
(-2.40%)Baseline: 219.64 ms
263.57 ms
(81.33%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,356.75 ms
(-3.31%)Baseline: 2,437.35 ms
2,924.82 ms
(80.58%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,389.79 ms
(-2.86%)Baseline: 4,518.89 ms
5,422.67 ms
(80.95%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
248.92 ms
(-11.71%)Baseline: 281.93 ms
338.32 ms
(73.57%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
647.02 ms
(-10.47%)Baseline: 722.72 ms
867.27 ms
(74.60%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13732
Testbedpnpr

⚠️ 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-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,439.93 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
290.37 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
290.92 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
84.30 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,354.52 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,443.19 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
251.65 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan marked this pull request as ready for review August 8, 2026 23:00
Copilot AI lite review requested due to automatic review settings August 8, 2026 23:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add get-pnpm: install pnpm via npx with registry signature verification

✨ Enhancement 🐞 Bug fix 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Add get-pnpm package to install pnpm via npx using the configured npm registry.
• Verify npm registry signatures and tarball checksums before executing pnpm setup --force.
• Fix pnpm setup to write type: "module" to avoid repeated MODULE_TYPELESS warnings.
Diagram

graph TD
  A(("User")) --> B["npx get-pnpm"] --> C{{"npm registry"}} --> D["verify signature"] --> E["download tarballs"] --> F["extract & assemble"] --> G["pnpm setup --force"] --> H[("PNPM_HOME")]

  subgraph Legend
    direction LR
    _actor(("Actor")) ~~~ _proc["Process"] ~~~ _ext{{"External"}} ~~~ _dir[("Directory")]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Use `npx -p @pnpm/exe pnpm setup --force` (no new package)
  • ➕ No new maintained package/workspace
  • ➕ Leverages existing wrapper behavior
  • ➖ npx cannot target a stable single bin from @pnpm/exe (multiple bins, none named exe)
  • ➖ Downloads can be duplicated due to optionalDependencies re-resolution during global install
  • ➖ Does not address the ‘single-command’ UX goal cleanly
2. Use a JS tar library (e.g., `tar`) instead of shelling out to `tar`
  • ➕ No dependency on host tar availability/behavior differences
  • ➕ More controllable error handling across platforms
  • ➖ Adds dependency weight to an npx-first installer
  • ➖ More surface area to audit/keep patched for a security-sensitive path
3. Reuse existing npm client libraries (e.g., `pacote`/`npm-registry-fetch`) for fetch/integrity
  • ➕ Battle-tested handling of registries, auth, proxies, integrity verification
  • ➕ Less bespoke HTTP/checksum code
  • ➖ Heavier dependency tree for an installer whose goal is minimal pre-pnpm downloads
  • ➖ Signature verification (pinned npm keys) still needs custom policy enforcement

Recommendation: The PR’s approach (small dependency footprint, registry-mirror-friendly source selection, and strict signature+checksum verification) is well-aligned with an npx installer. Keep the current strategy; the main tradeoff—requiring a working tar—is reasonable for the supported host set and avoids pulling extra dependencies into a security-sensitive bootstrapper.

Files changed (28) +1034 / -19

Enhancement (8) +491 / -0
get-pnpm.jsAdd 'get-pnpm' executable entrypoint +9/-0

Add 'get-pnpm' executable entrypoint

• Implements the Node shebang bin that calls 'runCli' and maps errors to exit code 1 with message output.

installer/bin/get-pnpm.js

extractTarball.tsAdd tarball extraction helper using system 'tar' +24/-0

Add tarball extraction helper using system 'tar'

• Adds an extraction utility that shells out to 'tar -xzf' and provides a clear error if 'tar' is missing. Avoids strip/select features to reduce incompatibilities across tar variants.

installer/src/extractTarball.ts

index.tsImplement installer flow: resolve, verify, download, assemble, run setup +195/-0

Implement installer flow: resolve, verify, download, assemble, run setup

• Adds the main installer implementation: resolves pnpm version from dist-tags, selects platform package name, downloads and verifies packages, assembles the standalone layout (including dist/ where needed), then runs 'pnpm setup --force'. Includes cleanup on exit signals and writes a minimal manifest for v11/v10 installs to preserve runtime deps and declare module type.

installer/src/index.ts

npmSigningKeys.tsAdd pinned npm registry signing keys (generated) +29/-0

Add pinned npm registry signing keys (generated)

• Adds a generated list of npm public signing keys for verifying registry signatures. Notes the update script and release workflow keep keys refreshed to handle rotation.

installer/src/npmSigningKeys.ts

platformPackageName.tsResolve platform-specific pnpm binary package name across majors +53/-0

Resolve platform-specific pnpm binary package name across majors

• Implements mapping for v12+ '@pnpm/exe.<platform>-<arch>[-musl]' vs legacy '@pnpm/<os>-<arch>' naming. Validates supported platforms/architectures and provides a specific error for the v11 Intel macOS gap.

installer/src/platformPackageName.ts

registry.tsAdd registry fetch + tarball download with checksum verification +90/-0

Add registry fetch + tarball download with checksum verification

• Implements registry selection from env, packument/version-meta fetch, and streaming tarball download while computing and validating integrity/shasum. Includes robust network/HTTP error messages.

installer/src/registry.ts

resolveVersion.tsResolve user version spec (dist-tag, exact, or major) +30/-0

Resolve user version spec (dist-tag, exact, or major)

• Adds logic to resolve a version spec with precedence for dist-tags, support for leading 'v', and major-to-tag fallback (latest-N then next-N). Produces helpful errors listing available tags.

installer/src/resolveVersion.ts

verifySignature.tsVerify npm registry signatures against pinned keys +61/-0

Verify npm registry signatures against pinned keys

• Adds signature verification over '<name>@<version>:<integrity>' using ECDSA keys pinned in-package. Rejects unsigned packages, untrusted/expired keys, and invalid signatures with actionable error messaging.

installer/src/verifySignature.ts

Bug fix (3) +46 / -11
setup-writes-module-type.mdAdd changeset for 'pnpm setup' module-type fix +7/-0

Add changeset for 'pnpm setup' module-type fix

• Adds a patch changeset for 'pnpm setup' writing '"type": "module"' in generated package.json. Explains it removes recurring MODULE_TYPELESS warnings.

.changeset/setup-writes-module-type.md

setup.rsFix 'pnpm setup' generated manifest to include 'type: module' +16/-6

Fix 'pnpm setup' generated manifest to include 'type: module'

• Refactors the temporary package.json generation into a helper and adds '"type": "module"'. Prevents Node from reparsing ESM runtime files as CommonJS and warning on each spawn.

pnpm/crates/cli/src/cli_args/setup.rs

setup.tsFix pnpm11 'setup' to write 'type: module' in generated manifest +23/-5

Fix pnpm11 'setup' to write 'type: module' in generated manifest

• Extracts manifest creation into an exported function and adds 'type: 'module'' to the generated package.json. Avoids MODULE_TYPELESS warnings for standalone executable installs on the v11 stack.

pnpm11/engine/pm/commands/src/setup/setup.ts

Tests (6) +304 / -2
installPnpm.test.tsAdd end-to-end installer tests with mock registry + signed metadata +117/-0

Add end-to-end installer tests with mock registry + signed metadata

• Creates a local HTTP registry that serves packument/meta/tarballs and signs metadata with a generated test key. Tests the expected setup invocation/layout, temp directory cleanup, and checksum-mismatch refusal (tampered tarball).

installer/test/installPnpm.test.ts

platformPackageName.test.tsTest platform package name mapping across pnpm majors +37/-0

Test platform package name mapping across pnpm majors

• Covers legacy vs v12 naming, musl suffix behavior, unsupported host rejection, and the v11 Intel macOS special-case guidance.

installer/test/platformPackageName.test.ts

resolveVersion.test.tsTest version resolution semantics and error reporting +41/-0

Test version resolution semantics and error reporting

• Validates dist-tag resolution, exact version resolution (with/without leading v), major-to-stable and major-to-prerelease fallback, and tag listing in errors.

installer/test/resolveVersion.test.ts

verifySignature.test.tsAdd unit tests for registry signature verification policy +84/-0

Add unit tests for registry signature verification policy

• Tests valid signature acceptance and failure modes: wrong checksum, wrong package, untrusted signing key, unpinned keyid, unsigned packages, and expired keys with controllable clock.

installer/test/verifySignature.test.ts

tests.rsAdd Rust unit test for standalone manifest module type +16/-2

Add Rust unit test for standalone manifest module type

• Imports the new helper and asserts the generated manifest includes 'type: module' alongside bin mappings and version.

pnpm/crates/cli/src/cli_args/setup/tests.rs

setup.test.tsAdd pnpm11 test asserting generated manifest declares module type +9/-0

Add pnpm11 test asserting generated manifest declares module type

• Adds coverage to ensure 'standaloneManifest()' includes 'type: 'module'' alongside the expected name/version/bin fields.

pnpm11/engine/pm/commands/test/setup/setup.test.ts

Documentation (2) +60 / -0
install-pnpm-with-npx.mdAdd changeset for new 'get-pnpm' package +13/-0

Add changeset for new 'get-pnpm' package

• Introduces a changeset announcing 'get-pnpm' and its 'npx get-pnpm' usage. Documents registry-based download and signature+checksum verification.

.changeset/install-pnpm-with-npx.md

README.mdDocument 'get-pnpm' usage and security model +47/-0

Document 'get-pnpm' usage and security model

• Adds README covering usage patterns (latest/major/dist-tag/exact) and environment variables. Explains registry signature verification and checksum validation before running 'pnpm setup'.

installer/README.md

Other (9) +133 / -6
index.tsExclude 'get-pnpm' from pnpm-major version normalization +7/-4

Exclude 'get-pnpm' from pnpm-major version normalization

• Renames the experimental package allowlist to independently-versioned packages and adds 'get-pnpm'. Prevents meta-updater from forcing the installer to track pnpm’s major-based versioning scheme.

.meta-updater/src/index.ts

cspell.jsonAdd installer-related terms to spelling dictionary +3/-0

Add installer-related terms to spelling dictionary

• Adds words used by the installer and warning text (e.g., bsdtar, reparses, TYPELESS) to cspell allowlist.

cspell.json

package.jsonCreate 'get-pnpm' package manifest and scripts +52/-0

Create 'get-pnpm' package manifest and scripts

• Defines the 'get-pnpm' npm package (ESM), exports, bin mapping, Node engine requirement, and build/lint/test scripts. Adds minimal runtime dependency on 'detect-libc' and sets up jest for the workspace package.

installer/package.json

tsconfig.jsonAdd test tsconfig for installer package +18/-0

Add test tsconfig for installer package

• Defines a test-specific tsconfig emitting into a temporary outDir, enabling isolatedModules, and referencing workspace typings needed for compilation.

installer/test/tsconfig.json

tsconfig.jsonAdd TypeScript build config for installer sources +12/-0

Add TypeScript build config for installer sources

• Sets up tsconfig extending shared config, targeting src->lib output, and includes required typings for build.

installer/tsconfig.json

tsconfig.lint.jsonAdd lint tsconfig including tests +8/-0

Add lint tsconfig including tests

• Configures lint-time TS include paths to cover src and test code for consistent type-aware linting.

installer/tsconfig.lint.json

pnpm-lock.yamlAdd installer workspace dependencies to lockfile +13/-0

Add installer workspace dependencies to lockfile

• Updates the lockfile with the new 'installer' importer and its dependencies/devDependencies (detect-libc, @jest/globals, workspace get-pnpm).

pnpm-lock.yaml

pnpm-workspace.yamlRegister 'installer' as a workspace package +1/-0

Register 'installer' as a workspace package

• Adds the new 'installer' package to the pnpm workspace configuration.

pnpm-workspace.yaml

update-npm-signing-keys.mjsMirror npm signing keys into 'get-pnpm' during key refresh +19/-2

Mirror npm signing keys into 'get-pnpm' during key refresh

• Enhances the key update script to also rewrite the installer’s pinned key file and fail CI if the mirrored files drift. Ensures key rotation updates both pnpm11 and 'get-pnpm' consistently.

pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs

@greptile-apps

greptile-apps Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (2): Last reviewed commit: "chore: keep the spellings the setup fix ..." | Re-trigger Greptile

Comment thread installer/src/verifySignature.ts Resolved
Comment thread installer/src/index.ts Resolved
Comment thread installer/src/extractTarball.ts Resolved
@qodo-code-review

qodo-code-review Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (5) 📜 Skill insights (0)

Grey Divider


Action required

1. Scoped package URL unescaped 🐞 Bug ≡ Correctness
Description
fetchVersionMeta() builds registry URLs using an unescaped scoped package name (e.g.
@pnpm/linux-x64), which turns the scope slash into a path separator instead of %2F. Against
standard npm registries this will request the wrong endpoint and can prevent fetching the platform
package needed to install pnpm.
Code

installer/src/registry.ts[R31-33]

+export async function fetchVersionMeta (registry: string, pkgName: string, version: string): Promise<VersionMeta> {
+  return fetchJson<VersionMeta>(new URL(`${pkgName}/${version}`, registry), 'application/json')
+}
Relevance

●●● Strong

URL-encoding scoped package names (replace/encode “/”) has been accepted for similar registry URL
construction.

PR-#12922
PR-#11495

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The installer currently uses raw scoped package names in URLs, while pnpm’s own registry mocking
(and npm registry semantics) use %2F-escaped scoped names, indicating the current URL construction
is incompatible with common registries.

installer/src/registry.ts[27-33]
installer/src/index.ts[114-119]
pnpm11/engine/pm/commands/test/self-updater/selfUpdate.test.ts[129-133]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`installer/src/registry.ts` constructs registry endpoints via `new URL(...)` with raw package names. For scoped names this yields `/@scope/name` instead of the npm-registry endpoint `/@scope%2Fname`, breaking metadata fetches for the scoped platform packages (`@pnpm/<os>-<arch>` for v11 and `@pnpm/exe.<platform>-<arch>` for v12+).

## Issue Context
The installer must fetch scoped platform packages to obtain the standalone executable; pnpm’s own registry mocks expect `%2F` encoding for scoped packages.

## Fix Focus Areas
- installer/src/registry.ts[27-33]

## Suggested fix
- Add a helper like `encodePkgPath(name: string): string` that returns:
 - `name.replaceAll('/', '%2F')` when `name.startsWith('@')`
 - otherwise `name`
- Use it consistently in both `fetchPackument()` and `fetchVersionMeta()`:
 - `new URL(encodePkgPath(pkgName), registry)`
 - `new URL(`${encodePkgPath(pkgName)}/${version}`, registry)`
- Add/adjust tests to cover a real scoped name path format (e.g. assert requests hit `/@pnpm%2Flinux-x64/...`).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Unsafe tarball extraction 🐞 Bug ⛨ Security
Description
The installer extracts remotely downloaded tarballs with tar -xzf without validating archive
member paths or rejecting symlinks/hardlinks, then renameSync/chmodSync/executes the extracted
pnpm file. If a (compromised or maliciously published) tarball contains traversal or link entries,
this can redirect filesystem writes/permission changes or execution outside the intended temp
directory.
Code

installer/src/extractTarball.ts[R13-15]

+  fs.mkdirSync(dest, { recursive: true })
+  const { error, status, stderr } = spawnSync('tar', ['-xzf', tarball, '-C', dest], { encoding: 'utf8' })
+  if (error != null) {
Relevance

●● Moderate

Security-hardening patterns are often accepted, but no close precedent for tar extraction validation
here.

PR-#12419
PR-#12669

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The code extracts with tar directly and then immediately uses the extracted executable path for
chmod and execution, which is precisely the pattern that becomes dangerous if the archive can
introduce symlinks/traversal. The review guide explicitly calls out archive extraction and
symlink/hardlink issues as high-priority security concerns.

installer/src/extractTarball.ts[12-23]
installer/src/index.ts[121-134]
REVIEW_GUIDE.md[48-58]
PR-#12820

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`extractTarball()` shells out to `tar` and trusts its extraction behavior. The installer later treats extracted paths as executable content (`renameSync`, `chmodSync`, and `spawnSync` on the resulting path). Without explicit post-extract validation, symlink/hardlink or traversal-style entries can cause the installer to operate on paths outside the temp tree.

## Issue Context
Although the tarball is checksum-verified and the checksum is signature-verified, this is still a defense-in-depth gap against compromised upstream artifacts and against tar implementation differences. The repo’s review guide explicitly calls out archive extraction + symlink/hardlink issues as high priority.

## Fix Focus Areas
- installer/src/extractTarball.ts[12-23]
- installer/src/index.ts[121-134]

## Suggested fix
- After extraction (before `renameSync`/`chmodSync`/execution), perform explicit validation:
 - `lstatSync` the extracted executable (`.../package/pnpm[.exe]`) and reject anything that is not a regular file (reject symlinks).
 - `realpathSync` the executable and require it to be within `realpathSync(platformPkg.dir)`.
 - If `dist/` is used, ensure it is a real directory (not a symlink) and optionally walk it rejecting symlinks.
- Optionally harden extraction itself:
 - Pre-list entries (e.g. `tar -tzf`) and reject absolute paths and `..` segments.
 - Add tar flags where available to reduce risky behavior (e.g. `--no-same-owner`, `--no-same-permissions`).
- Ensure error messages are explicit about refusing unsafe archive contents.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Historical phrasing in v11 comment 📘 Rule violation ⚙ Maintainability
Description
A newly added inline comment uses historical phrasing (“v11 was the first release…”) instead of
describing the current version-based behavior directly, which the checklist forbids for inline
comments.
Code

installer/src/index.ts[R116-119]

+      // v11 was the first release to keep files next to the executable; up to
+      // v10 the executable is self-contained and ships no `dist/`.
+      major >= 11 ? fetchPackage(wrapperPackageName(major)) : undefined,
+    ])
Relevance

●●● Strong

Historical/temporal phrasing in comments is frequently asked to be rewritten and accepted.

PR-#13004
PR-#13559
PR-#13138

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist prohibits comments that refer to past behavior with historical phrasing. The added
comment uses “was the first release” and “up to v10”, which is explicitly the kind of temporal
framing the rule flags.

Rule 772199: Comments must describe current behavior, not historical implementations
installer/src/index.ts[116-119]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A comment describes behavior using historical framing rather than stating the current version-conditional behavior.

## Issue Context
The logic is version-based; the comment can state the invariant directly (e.g., “For v10 and earlier…, for v11+ …”) without “first/used to” phrasing.

## Fix Focus Areas
- installer/src/index.ts[116-119]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. extractTarball JSDoc lacks contract 📘 Rule violation ⚙ Maintainability
Description
extractTarball()’s JSDoc focuses on implementation details (shelling out to tar) and omits key
contract elements like error/throw conditions despite the function throwing on failure.
Code

installer/src/extractTarball.ts[R4-7]

+/**
+ * Unpacks a package tarball into `dest`, leaving its `package/` root in place.
+ *
+ * Shells out to `tar`, which every supported host has: macOS and Linux ship it,
Relevance

●●● Strong

Team has accepted updating JSDoc to match contract/throw behavior in similar cases.

PR-#12292
PR-#12954

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires JSDoc to document preconditions/postconditions and error behavior, not
narrate implementation. The comment emphasizes how tar is invoked but does not describe the
function’s thrown errors, even though the implementation throws on missing tar and non-zero exit
status.

Rule 713430: JSDoc must document function contracts, not re-describe implementation
installer/src/extractTarball.ts[4-7]
installer/src/extractTarball.ts[14-23]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The JSDoc for `extractTarball()` is written as an implementation narrative and does not document the function contract (notably its error conditions).

## Issue Context
This function throws when `tar` is missing and when extraction fails; callers need those guarantees documented.

## Fix Focus Areas
- installer/src/extractTarball.ts[4-23]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. wrapperPackageName declared before use 📘 Rule violation ⚙ Maintainability
Description
wrapperPackageName() is declared before its first in-file usage, violating the project’s
TypeScript function-order rule and making control flow harder to follow in this file.
Code

installer/src/index.ts[R29-32]

+/** Where the `dist/` tree that ships beside the executable is published. */
+function wrapperPackageName (major: number): string {
+  return major >= 12 ? CLI_PKG_NAME : '@pnpm/exe'
+}
Relevance

●●● Strong

Repo consistently enforces “declare TS functions after first use” ordering rule.

PR-#12964
PR-#12789
PR-#13398

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires that TypeScript function declarations appear only after at least one usage in
the same file. wrapperPackageName() is declared near the top of the file and is first used later
when selecting wrapperPkg for download.

Rule 713432: Declare TypeScript functions only after their first usage
installer/src/index.ts[29-32]
installer/src/index.ts[114-119]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
In `installer/src/index.ts`, the top-level function declaration `wrapperPackageName()` appears before any usage in the same file, but the codebase requires function declarations to appear only after their first usage.

## Issue Context
This rule is intended to keep the file’s execution/reading order linear, placing helper declarations after the code that uses them.

## Fix Focus Areas
- installer/src/index.ts[29-32]
- installer/src/index.ts[114-119]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

6. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The new changeset for get-pnpm does not include an explicit pnpm bump entry, violating the
changeset requirement that pnpm be declared in the front-matter.
Code

.changeset/install-pnpm-with-npx.md[R1-3]

+---
+"get-pnpm": minor
+---
Relevance

● Weak

Similar “add pnpm entry to changeset front-matter” suggestions were rejected in recent PRs.

PR-#13708
PR-#13707
PR-#13734

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires changesets to explicitly declare the pnpm package and a valid bump type.
This changeset only declares get-pnpm and omits pnpm entirely.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/install-pnpm-with-npx.md[1-3]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The changeset `.changeset/install-pnpm-with-npx.md` does not declare a bump for `pnpm` in its front-matter.

## Issue Context
The compliance checklist requires an explicit `pnpm` entry (with bump type `patch`/`minor`/`major`) in newly added or modified changesets.

## Fix Focus Areas
- .changeset/install-pnpm-with-npx.md[1-3]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. Missing trailing comma in opts 📘 Rule violation ⚙ Maintainability
Description
The multi-line opts type for installPnpm() omits a trailing comma on the last property, creating
inconsistent diffs and violating the TypeScript trailing-comma requirement.
Code

installer/src/index.ts[R84-87]

+    versionSpec: string
+    registry: string
+    keys?: readonly SigningKey[]
+  }
Relevance

● Weak

Very similar trailing-comma-in-multiline-TS suggestions have been rejected repeatedly.

PR-#12878
PR-#13600
PR-#13428

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires trailing commas for multi-line TypeScript constructs. In the opts type
literal, the last entry keys?: readonly SigningKey[] has no trailing comma.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
installer/src/index.ts[84-87]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A multi-line TypeScript type literal in `installPnpm()` is missing a trailing comma on the last property.

## Issue Context
The repo requires trailing commas in multi-line TypeScript constructs to keep diffs stable.

## Fix Focus Areas
- installer/src/index.ts[84-87]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. HTTP registry enables rollback 🐞 Bug ⛨ Security
Description
registryFromEnv() accepts npm_config_registry with any scheme (including http:), and version
selection uses unsigned dist-tags from the packument. A network attacker on an HTTP registry path
can rewrite dist-tags to force installing an older (still correctly signed) pnpm release, bypassing
freshness expectations despite signature+checksum verification of the selected tarball.
Code

installer/src/registry.ts[R22-25]

+export function registryFromEnv (): string {
+  const registry = process.env.npm_config_registry ?? process.env.NPM_CONFIG_REGISTRY ?? DEFAULT_REGISTRY
+  return registry.endsWith('/') ? registry : `${registry}/`
+}
Relevance

● Weak

HTTPS-only / rejecting http:// scheme hardening suggestions were rejected in a close precedent.

PR-#13230

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The registry URL is taken directly from env and can be HTTP, and the installer resolves versions
from packument dist-tags which are not covered by the npm signature check (which only covers the
final name@version:integrity). This creates a straightforward dist-tag rollback path on insecure
transport.

installer/src/registry.ts[21-25]
installer/src/index.ts[89-91]
REVIEW_GUIDE.md[54-57]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The installer’s cryptographic verification covers `name@version:integrity`, but the chosen `version` for dist-tags (e.g. `latest`) comes from an unsigned packument response. If the registry URL is plain HTTP, a MITM can alter dist-tags to point to an older legitimate version and the installer will accept it.

## Issue Context
This is a rollback/downgrade risk rather than a direct integrity-bypass: the installed bits can still be authentic, but not the intended/current release.

## Fix Focus Areas
- installer/src/registry.ts[21-25]
- installer/src/index.ts[89-91]

## Suggested fix
- In `registryFromEnv()`, parse the registry as a `URL` and:
 - Reject non-`https:` registries by default with a clear error explaining the rollback risk.
 - Provide an explicit opt-in escape hatch (e.g. `GET_PNPM_ALLOW_INSECURE_REGISTRY=1`) if you need to support HTTP in controlled environments.
- Consider additionally rejecting `meta.dist.tarball` URLs that are non-HTTPS unless the same explicit opt-in is set.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context used
✅ Compliance rules (platform): 26 rules

Grey Divider

Tip of the day
💡 Did you know, you can ask Qodo to dismiss a finding you disagree with, with your reason on record

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous review results

Review updated until commit 3ace631 ⚖️ Balanced

Results up to commit 21178e6 ⚖️ Balanced


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


Action required
1. Scoped package URL unescaped 🐞 Bug ≡ Correctness
Description
fetchVersionMeta() builds registry URLs using an unescaped scoped package name (e.g.
@pnpm/linux-x64), which turns the scope slash into a path separator instead of %2F. Against
standard npm registries this will request the wrong endpoint and can prevent fetching the platform
package needed to install pnpm.
Code

installer/src/registry.ts[R31-33]

+export async function fetchVersionMeta (registry: string, pkgName: string, version: string): Promise<VersionMeta> {
+  return fetchJson<VersionMeta>(new URL(`${pkgName}/${version}`, registry), 'application/json')
+}
Relevance

●●● Strong

URL-encoding scoped package names (replace/encode “/”) has been accepted for similar registry URL
construction.

PR-#12922
PR-#11495

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The installer currently uses raw scoped package names in URLs, while pnpm’s own registry mocking
(and npm registry semantics) use %2F-escaped scoped names, indicating the current URL construction
is incompatible with common registries.

installer/src/registry.ts[27-33]
installer/src/index.ts[114-119]
pnpm11/engine/pm/commands/test/self-updater/selfUpdate.test.ts[129-133]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`installer/src/registry.ts` constructs registry endpoints via `new URL(...)` with raw package names. For scoped names this yields `/@scope/name` instead of the npm-registry endpoint `/@scope%2Fname`, breaking metadata fetches for the scoped platform packages (`@pnpm/<os>-<arch>` for v11 and `@pnpm/exe.<platform>-<arch>` for v12+).

## Issue Context
The installer must fetch scoped platform packages to obtain the standalone executable; pnpm’s own registry mocks expect `%2F` encoding for scoped packages.

## Fix Focus Areas
- installer/src/registry.ts[27-33]

## Suggested fix
- Add a helper like `encodePkgPath(name: string): string` that returns:
 - `name.replaceAll('/', '%2F')` when `name.startsWith('@')`
 - otherwise `name`
- Use it consistently in both `fetchPackument()` and `fetchVersionMeta()`:
 - `new URL(encodePkgPath(pkgName), registry)`
 - `new URL(`${encodePkgPath(pkgName)}/${version}`, registry)`
- Add/adjust tests to cover a real scoped name path format (e.g. assert requests hit `/@pnpm%2Flinux-x64/...`).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Unsafe tarball extraction 🐞 Bug ⛨ Security
Description
The installer extracts remotely downloaded tarballs with tar -xzf without validating archive
member paths or rejecting symlinks/hardlinks, then renameSync/chmodSync/executes the extracted
pnpm file. If a (compromised or maliciously published) tarball contains traversal or link entries,
this can redirect filesystem writes/permission changes or execution outside the intended temp
directory.
Code

installer/src/extractTarball.ts[R13-15]

+  fs.mkdirSync(dest, { recursive: true })
+  const { error, status, stderr } = spawnSync('tar', ['-xzf', tarball, '-C', dest], { encoding: 'utf8' })
+  if (error != null) {
Relevance

●● Moderate

Security-hardening patterns are often accepted, but no close precedent for tar extraction validation
here.

PR-#12419
PR-#12669

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The code extracts with tar directly and then immediately uses the extracted executable path for
chmod and execution, which is precisely the pattern that becomes dangerous if the archive can
introduce symlinks/traversal. The review guide explicitly calls out archive extraction and
symlink/hardlink issues as high-priority security concerns.

installer/src/extractTarball.ts[12-23]
installer/src/index.ts[121-134]
REVIEW_GUIDE.md[48-58]
PR-#12820

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`extractTarball()` shells out to `tar` and trusts its extraction behavior. The installer later treats extracted paths as executable content (`renameSync`, `chmodSync`, and `spawnSync` on the resulting path). Without explicit post-extract validation, symlink/hardlink or traversal-style entries can cause the installer to operate on paths outside the temp tree.

## Issue Context
Although the tarball is checksum-verified and the checksum is signature-verified, this is still a defense-in-depth gap against compromised upstream artifacts and against tar implementation differences. The repo’s review guide explicitly calls out archive extraction + symlink/hardlink issues as high priority.

## Fix Focus Areas
- installer/src/extractTarball.ts[12-23]
- installer/src/index.ts[121-134]

## Suggested fix
- After extraction (before `renameSync`/`chmodSync`/execution), perform explicit validation:
 - `lstatSync` the extracted executable (`.../package/pnpm[.exe]`) and reject anything that is not a regular file (reject symlinks).
 - `realpathSync` the executable and require it to be within `realpathSync(platformPkg.dir)`.
 - If `dist/` is used, ensure it is a real directory (not a symlink) and optionally walk it rejecting symlinks.
- Optionally harden extraction itself:
 - Pre-list entries (e.g. `tar -tzf`) and reject absolute paths and `..` segments.
 - Add tar flags where available to reduce risky behavior (e.g. `--no-same-owner`, `--no-same-permissions`).
- Ensure error messages are explicit about refusing unsafe archive contents.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended
3. wrapperPackageName declared before use 📘 Rule violation ⚙ Maintainability
Description
wrapperPackageName() is declared before its first in-file usage, violating the project’s
TypeScript function-order rule and making control flow harder to follow in this file.
Code

installer/src/index.ts[R29-32]

+/** Where the `dist/` tree that ships beside the executable is published. */
+function wrapperPackageName (major: number): string {
+  return major >= 12 ? CLI_PKG_NAME : '@pnpm/exe'
+}
Relevance

●●● Strong

Repo consistently enforces “declare TS functions after first use” ordering rule.

PR-#12964
PR-#12789
PR-#13398

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires that TypeScript function declarations appear only after at least one usage in
the same file. wrapperPackageName() is declared near the top of the file and is first used later
when selecting wrapperPkg for download.

Rule 713432: Declare TypeScript functions only after their first usage
installer/src/index.ts[29-32]
installer/src/index.ts[114-119]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
In `installer/src/index.ts`, the top-level function declaration `wrapperPackageName()` appears before any usage in the same file, but the codebase requires function declarations to appear only after their first usage.

## Issue Context
This rule is intended to keep the file’s execution/reading order linear, placing helper declarations after the code that uses them.

## Fix Focus Areas
- installer/src/index.ts[29-32]
- installer/src/index.ts[114-119]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. extractTarball JSDoc lacks contract 📘 Rule violation ⚙ Maintainability
Description
extractTarball()’s JSDoc focuses on implementation details (shelling out to tar) and omits key
contract elements like error/throw conditions despite the function throwing on failure.
Code

installer/src/extractTarball.ts[R4-7]

+/**
+ * Unpacks a package tarball into `dest`, leaving its `package/` root in place.
+ *
+ * Shells out to `tar`, which every supported host has: macOS and Linux ship it,
Relevance

●●● Strong

Team has accepted updating JSDoc to match contract/throw behavior in similar cases.

PR-#12292
PR-#12954

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires JSDoc to document preconditions/postconditions and error behavior, not
narrate implementation. The comment emphasizes how tar is invoked but does not describe the
function’s thrown errors, even though the implementation throws on missing tar and non-zero exit
status.

Rule 713430: JSDoc must document function contracts, not re-describe implementation
installer/src/extractTarball.ts[4-7]
installer/src/extractTarball.ts[14-23]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The JSDoc for `extractTarball()` is written as an implementation narrative and does not document the function contract (notably its error conditions).

## Issue Context
This function throws when `tar` is missing and when extraction fails; callers need those guarantees documented.

## Fix Focus Areas
- installer/src/extractTarball.ts[4-23]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Historical phrasing in v11 comment 📘 Rule violation ⚙ Maintainability
Description
A newly added inline comment uses historical phrasing (“v11 was the first release…”) instead of
describing the current version-based behavior directly, which the checklist forbids for inline
comments.
Code

installer/src/index.ts[R116-119]

+      // v11 was the first release to keep files next to the executable; up to
+      // v10 the executable is self-contained and ships no `dist/`.
+      major >= 11 ? fetchPackage(wrapperPackageName(major)) : undefined,
+    ])
Relevance

●●● Strong

Historical/temporal phrasing in comments is frequently asked to be rewritten and accepted.

PR-#13004
PR-#13559
PR-#13138

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist prohibits comments that refer to past behavior with historical phrasing. The added
comment uses “was the first release” and “up to v10”, which is explicitly the kind of temporal
framing the rule flags.

Rule 772199: Comments must describe current behavior, not historical implementations
installer/src/index.ts[116-119]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A comment describes behavior using historical framing rather than stating the current version-conditional behavior.

## Issue Context
The logic is version-based; the comment can state the invariant directly (e.g., “For v10 and earlier…, for v11+ …”) without “first/used to” phrasing.

## Fix Focus Areas
- installer/src/index.ts[116-119]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational
6. Missing trailing comma in opts 📘 Rule violation ⚙ Maintainability
Description
The multi-line opts type for installPnpm() omits a trailing comma on the last property, creating
inconsistent diffs and violating the TypeScript trailing-comma requirement.
Code

installer/src/index.ts[R84-87]

+    versionSpec: string
+    registry: string
+    keys?: readonly SigningKey[]
+  }
Relevance

● Weak

Very similar trailing-comma-in-multiline-TS suggestions have been rejected repeatedly.

PR-#12878
PR-#13600
PR-#13428

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires trailing commas for multi-line TypeScript constructs. In the opts type
literal, the last entry keys?: readonly SigningKey[] has no trailing comma.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
installer/src/index.ts[84-87]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A multi-line TypeScript type literal in `installPnpm()` is missing a trailing comma on the last property.

## Issue Context
The repo requires trailing commas in multi-line TypeScript constructs to keep diffs stable.

## Fix Focus Areas
- installer/src/index.ts[84-87]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The new changeset for get-pnpm does not include an explicit pnpm bump entry, violating the
changeset requirement that pnpm be declared in the front-matter.
Code

.changeset/install-pnpm-with-npx.md[R1-3]

+---
+"get-pnpm": minor
+---
Relevance

● Weak

Similar “add pnpm entry to changeset front-matter” suggestions were rejected in recent PRs.

PR-#13708
PR-#13707
PR-#13734

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The checklist requires changesets to explicitly declare the pnpm package and a valid bump type.
This changeset only declares get-pnpm and omits pnpm entirely.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/install-pnpm-with-npx.md[1-3]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The changeset `.changeset/install-pnpm-with-npx.md` does not declare a bump for `pnpm` in its front-matter.

## Issue Context
The compliance checklist requires an explicit `pnpm` entry (with bump type `patch`/`minor`/`major`) in newly added or modified changesets.

## Fix Focus Areas
- .changeset/install-pnpm-with-npx.md[1-3]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. HTTP registry enables rollback 🐞 Bug ⛨ Security
Description
registryFromEnv() accepts npm_config_registry with any scheme (including http:), and version
selection uses unsigned dist-tags from the packument. A network attacker on an HTTP registry path
can rewrite dist-tags to force installing an older (still correctly signed) pnpm release, bypassing
freshness expectations despite signature+checksum verification of the selected tarball.
Code

installer/src/registry.ts[R22-25]

+export function registryFromEnv (): string {
+  const registry = process.env.npm_config_registry ?? process.env.NPM_CONFIG_REGISTRY ?? DEFAULT_REGISTRY
+  return registry.endsWith('/') ? registry : `${registry}/`
+}
Relevance

● Weak

HTTPS-only / rejecting http:// scheme hardening suggestions were rejected in a close precedent.

PR-#13230

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The registry URL is taken directly from env and can be HTTP, and the installer resolves versions
from packument dist-tags which are not covered by the npm signature check (which only covers the
final name@version:integrity). This creates a straightforward dist-tag rollback path on insecure
transport.

installer/src/registry.ts[21-25]
installer/src/index.ts[89-91]
REVIEW_GUIDE.md[54-57]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The installer’s cryptographic verification covers `name@version:integrity`, but the chosen `version` for dist-tags (e.g. `latest`) comes from an unsigned packument response. If the registry URL is plain HTTP, a MITM can alter dist-tags to point to an older legitimate version and the installer will accept it.

## Issue Context
This is a rollback/downgrade risk rather than a direct integrity-bypass: the installed bits can still be authentic, but not the intended/current release.

## Fix Focus Areas
- installer/src/registry.ts[21-25]
- installer/src/index.ts[89-91]

## Suggested fix
- In `registryFromEnv()`, parse the registry as a `URL` and:
 - Reject non-`https:` registries by default with a clear error explaining the rollback risk.
 - Provide an explicit opt-in escape hatch (e.g. `GET_PNPM_ALLOW_INSECURE_REGISTRY=1`) if you need to support HTTP in controlled environments.
- Consider additionally rejecting `meta.dist.tarball` URLs that are non-HTTPS unless the same explicit opt-in is set.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Qodo Logo

Comment thread installer/src/registry.ts Resolved
Comment thread installer/src/extractTarball.ts Resolved
@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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (3)
installer/src/resolveVersion.ts (1)

24-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Replace the custom regular expression.

Line 24 uses /^\d+$/ for a simple digit check. Use plain string operations for this case.

As per coding guidelines, “Prefer plain string operations over custom regular expressions.”

🤖 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 `@installer/src/resolveVersion.ts` at line 24, Replace the regular-expression
check in resolveVersion with plain string operations that determine whether
version contains only digits, preserving the existing behavior for empty and
non-numeric values.

Source: Coding guidelines

.changeset/install-pnpm-with-npx.md (1)

5-13: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep the changeset focused on user-visible behavior.

Move the signature verification mechanics, pinned-key details, and registry implementation details to the README or PR description. Keep this entry to the new npx get-pnpm installation capability and its observable result.

Based on learnings, Changesets should describe concise user-visible behavior rather than implementation rationale.

🤖 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 @.changeset/install-pnpm-with-npx.md around lines 5 - 13, Rewrite the
changeset to describe only the user-visible addition of installing pnpm via `npx
get-pnpm`, including support for selecting versions and the resulting pnpm setup
on the user’s PATH. Remove signature verification, pinned-key, registry,
download-source, and implementation-detail explanations; place those details in
the README or PR description instead.

Sources: Path instructions, Learnings

installer/test/installPnpm.test.ts (1)

86-99: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Test the pre-v12 manifest path.

This suite resolves version 99.0.0, so writeManifest() returns before it writes the v11 manifest. Add a v11 wrapper fixture with package.json dependencies. Assert that setup receives a manifest with "type": "module", both bin aliases, and copied dependencies. Then run only this test file through the installer test script.

As per path instructions, provide meaningful regression tests for setup manifests.

🤖 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 `@installer/test/installPnpm.test.ts` around lines 86 - 99, Add a v11 wrapper
fixture with a package.json containing dependencies, and add a regression test
around installPnpm that exercises the pre-v12 writeManifest path. Assert setup
receives a manifest with module type, both bin aliases, and copied dependencies,
then run only installer/test/installPnpm.test.ts through the installer test
script.

Source: Path instructions

🤖 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 `@installer/src/extractTarball.ts`:
- Around line 12-22: Update extractTarball to inspect the tarball’s archive
members before running the existing tar extraction, rejecting symlink, hardlink,
absolute-path, and normalized paths that escape dest; abort with an error before
any extraction occurs. Preserve the current mkdirSync and tar error handling for
archives that pass validation.

In `@installer/src/registry.ts`:
- Line 41: Update the tarball fetch around request(new URL(meta.dist.tarball))
to treat registry metadata as untrusted: require an HTTPS URL, enforce its
origin against the configured explicit mirror policy, and reject redirects or
validate each redirect target with the same checks. Ensure disallowed origins
and redirect targets are rejected before fetching.
- Around line 40-89: Replace expected plain Error throws with PnpmError in
downloadTarball() and its checksum/request helpers in installer/src/registry.ts
(lines 40-89), resolveVersion() in installer/src/resolveVersion.ts (lines
17-29), and verifyRegistrySignature() in installer/src/verifySignature.ts (lines
27-60); assign a distinct error code to each failure type, preserve existing
messages and causes, and add `@pnpm/error` as a runtime dependency in
installer/package.json.

In `@installer/src/verifySignature.ts`:
- Around line 51-53: Define and implement a historical-package policy that
permits exact-version releases signed by retained, expired npm keys while still
rejecting keys outside the supported retention policy. Align verifySignature’s
expiry validation, npmSigningKeys generation/retention in
update-npm-signing-keys.mjs, and regression fixtures so key expiry is evaluated
against the requested package version’s signing context rather than only
opts.now.

---

Nitpick comments:
In @.changeset/install-pnpm-with-npx.md:
- Around line 5-13: Rewrite the changeset to describe only the user-visible
addition of installing pnpm via `npx get-pnpm`, including support for selecting
versions and the resulting pnpm setup on the user’s PATH. Remove signature
verification, pinned-key, registry, download-source, and implementation-detail
explanations; place those details in the README or PR description instead.

In `@installer/src/resolveVersion.ts`:
- Line 24: Replace the regular-expression check in resolveVersion with plain
string operations that determine whether version contains only digits,
preserving the existing behavior for empty and non-numeric values.

In `@installer/test/installPnpm.test.ts`:
- Around line 86-99: Add a v11 wrapper fixture with a package.json containing
dependencies, and add a regression test around installPnpm that exercises the
pre-v12 writeManifest path. Assert setup receives a manifest with module type,
both bin aliases, and copied dependencies, then run only
installer/test/installPnpm.test.ts through the installer test script.
🪄 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: 7780b4b1-cd6b-43dd-b8bb-1f97eb39f248

📥 Commits

Reviewing files that changed from the base of the PR and between 4e68132 and 21178e6.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
📒 Files selected for processing (27)
  • .changeset/install-pnpm-with-npx.md
  • .changeset/setup-writes-module-type.md
  • .meta-updater/src/index.ts
  • cspell.json
  • installer/README.md
  • installer/bin/get-pnpm.js
  • installer/package.json
  • installer/src/extractTarball.ts
  • installer/src/index.ts
  • installer/src/npmSigningKeys.ts
  • installer/src/platformPackageName.ts
  • installer/src/registry.ts
  • installer/src/resolveVersion.ts
  • installer/src/verifySignature.ts
  • installer/test/installPnpm.test.ts
  • installer/test/platformPackageName.test.ts
  • installer/test/resolveVersion.test.ts
  • installer/test/tsconfig.json
  • installer/test/verifySignature.test.ts
  • installer/tsconfig.json
  • installer/tsconfig.lint.json
  • pnpm-workspace.yaml
  • pnpm/crates/cli/src/cli_args/setup.rs
  • pnpm/crates/cli/src/cli_args/setup/tests.rs
  • pnpm11/deps/security/signatures/scripts/update-npm-signing-keys.mjs
  • pnpm11/engine/pm/commands/src/setup/setup.ts
  • pnpm11/engine/pm/commands/test/setup/setup.test.ts

Comment thread installer/src/extractTarball.ts Resolved
Comment thread installer/src/registry.ts Resolved
Comment thread installer/src/registry.ts Resolved
Comment thread installer/src/verifySignature.ts Resolved
zkochan added 2 commits August 9, 2026 14:58
…ndalone executable

When `pnpm setup` runs from a standalone executable whose directory has
no `package.json` — the tarball that https://get.pnpm.io/install.sh
downloads — it writes one so the global install has a package to
install. That manifest omitted `"type": "module"`, so Node.js reparsed
the ESM files shipped next to the executable (`dist/worker.js`) as
CommonJS first and printed a `MODULE_TYPELESS_PACKAGE_JSON` warning on
every spawn.

The published `@pnpm/exe` manifest already declares the module type, so
this only affected installs made through the standalone script.

Fixed in both stacks. The manifest construction moves into
`standaloneManifest` / `standalone_manifest`, so it can be asserted
without running the global install the surrounding function performs.
They arrived with the installer package, which now lives in
pnpm/get.pnpm.io; the two words are still used by the comment and the
changeset here.
Copilot AI review requested due to automatic review settings August 9, 2026 13:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Aug 9, 2026
@zkochan zkochan changed the title feat(installer): add get-pnpm, a pnpm installer runnable with npx fix(setup): declare the module type in the manifest written for a standalone executable Aug 9, 2026
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 3ace631

@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 commented Aug 9, 2026

Copy link
Copy Markdown
Member Author

The open conversations on this PR are all on installer/**, which this branch no longer contains — the package moved to pnpm/get.pnpm.io#51 (merged, published as [email protected]) so it sits beside install.sh and install.ps1 and shares their pinned npm signing key. This PR is now just the pnpm setup fix.

The findings did not go with them, so for the record, checked against the code as shipped:

Fixed in get.pnpm.io before it merged

  • First-signature-only verification — real, and the best of the batch: a rotation could make the installer refuse a package a pinned key had correctly signed. The signature is now selected by matching keyid, with a test that puts an unpinned signature first.
  • Signal listeners outlive installation — fixed; they are removed in the same finally that removes the temporary directory. It matters because installPnpm is a library function, and pnpm/setup is now a caller.

Checked and not defects

  • Scoped package URL unescaped — new URL(pkgName, registry) yields https://registry.npmjs.org/@pnpm/exe.linux-x64/12.0.0-rc.1, which the registry serves; the escaped form is an alternative, not a requirement. Every real install in testing went through this path.
  • Unsafe tarball extraction — the tarball is checked against a checksum npm signed before anything is unpacked, so reaching the extractor at all requires npm's private key. Independently, tar refuses traversal members: tar: package/../../escaped: Member name contains '..'.
  • Constrain tarball URL origins — the URL comes from registry metadata, but the bytes must still match the signed checksum, so pointing it elsewhere cannot change what gets installed.

Deliberate, and written down rather than silently chosen

  • Key-expiry policy — an expired key is rejected even though packages signed before its expiry were legitimately signed. A registry signature carries no trusted timestamp, so a signature made before an expiry cannot be told apart from one forged after it. These installers only ever fetch current releases, so strictness costs nothing there.

Resolving them here; anything still worth pursuing belongs in get.pnpm.io.


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

@zkochan
zkochan merged commit 4a5a10d into main Aug 9, 2026
38 checks passed
@zkochan
zkochan deleted the npx-install branch August 9, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet product: pnpm@11 reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants