Skip to content

fix(deps)!: update tar to 8 and pacote/arborist to the npm 11 stack - #6243

Open
edusperoni wants to merge 1 commit into
mainfrom
chore/npm11-node22-deps
Open

edusperoni wants to merge 1 commit into
mainfrom
chore/npm11-node22-deps

Conversation

@edusperoni

@edusperoni edusperoni commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

PR Checklist

What is the current behavior?

Stacked on #6242. After that PR, a fresh install of the published manifest still reports 13 advisories:

  • tar 7.5.22 (high). About 20 extraction advisories: symlink escapes, PAX header injection, path-reservation memory amplification and others. Almost all are fixed only in 8.x. The CLI extracts every template and platform package with tar.x() in PacoteService.extractPackage.
  • pacote 21 and @npmcli/arborist 9 (moderate). They pull in sigstore, tuf-js, @tufjs/models, npm-packlist, ignore-walk and @npmcli/metavuln-calculator releases that sit on the vulnerable minimatch 10.

What is the new behavior?

  • tar 7.5.22 → 8.1.2, pacote 21.5.1 → 22.0.2, @npmcli/arborist 9.1.8 → 10.0.5. The lockfile changes stay inside npm's own package stack, and no dev dependencies change.
  • tar 8 drops Node streams for a promise API. extractPackage now passes the tarball as the input option of tar.x() and awaits it, instead of piping into a writable stream. The previous version also kept going after a failed pacote.tarball(), which now just throws.
  • The extractPackage tests were describe.skip. They now run and extract a real tarball: the strip of package/, the filter option, a fetch error and a corrupt archive.
  • engines.node becomes ^22.22.2 || ^24.15.0 || >=26.0.0, which matches what pacote 22 and @npmcli/arborist 10 declare. The CLI test matrix drops 20.x. The CLI release workflow moves from Node 22.14.0, which is outside the range, to 22.23.5. The doctor package's jobs are unchanged and keep their Node 20 leg.

Audit: a fresh consumer install goes from 13 to 3 (2 moderate, 1 high). All three come from npm's own packages and can only be fixed upstream:

  • tar 7.5.24 (high), via pacote 22 (^7.4.3) and node-gyp 13 (^7.5.4). The CLI's own extraction uses tar 8.
  • minimatch 10.2.6, via @npmcli/arborist 10 and its workspace and package-json helpers (^10.0.3). This is also why @npmcli/arborist itself is flagged.

Verification: npm test passes (141 files, 2450 passed, 0 skipped), and so does tsc -p tsconfig.release.json. I also ran ns create end to end with the built CLI and @nativescript/template-blank-ts, which fetches and extracts through pacote 22 and tar 8.

Notes for review

  • IPacoteExtractOptions.filter in lib/definitions/pacote-service.d.ts now receives a tar.ReadEntry instead of tar.FileStat, which tar 8 no longer exports. No caller in the CLI passes a filter.
  • The release workflow's Node bump is not exercised until the next release.

BREAKING CHANGES:

The CLI no longer supports Node.js 20, which reached end of life in April 2026. The supported range also excludes 22.x before 22.22.2, 24.x before 24.15.0, and the odd releases 23 and 25. On an unsupported version the CLI prints the "Support for Node.js … is not verified" warning, but it still runs. The hard floor in verify-node-version.ts is unchanged.

Migration steps:
Upgrade to Node.js 22.22.2 or later on 22.x, 24.15.0 or later on 24.x, or Node.js 26 and later.

Summary by CodeRabbit

  • New Features
    • Package extraction now omits the archive’s top-level package directory and supports filtering entries with their full archive entry details.
  • Bug Fixes
    • Extraction errors, including invalid archives and download failures, are now reported to callers.
  • Compatibility
    • Supported Node.js versions are now 22.22.2 or later in the 22.x line, 24.15.0 or later in the 24.x line, or 26.x and later.

@edusperoni
edusperoni added this pull request to stack #6244 December 4, 2026 03:03
@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change updates Node.js versions and package dependencies. Package extraction now fetches tarball data and passes it to tar.x. The extraction tests cover directory stripping, filtering, and fetch or invalid-data errors.

Changes: Package runtime and extraction

Layer / File(s) Summary
Runtime and dependency targets
package.json, .github/workflows/tests.yml, .github/workflows/npm_release_cli.yml
The package dependency versions and supported Node.js engine range change. The test matrix removes Node 20 and includes Node 22 and 24. Release jobs use Node 22.23.5.
Direct tar extraction
lib/definitions/pacote-service.d.ts, lib/services/pacote-service.ts, test/services/pacote-service.ts
The extraction filter callback now uses tar.ReadEntry. extractPackage fetches tarball data and passes it to tar.x, with strip: 1, the destination as cwd, and supplied options. Active tests cover extraction, filtering, and errors.

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

Change: Other

Possibly related PRs

Suggested reviewers: nathanwalker, rigor789

Merge Risk: Low · up to 25492 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: upgrading tar to 8 and the pacote/arborist (npm 11 stack) dependencies. The changeset also includes the extraction logic rewrite that tar 8 requires, the Node engine r…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: upgrading tar to 8 and the pacote/arborist (npm 11 stack) dependencies. The changeset also includes the extraction logic rewrite that tar 8 requires, the Node engine range change, and CI Node version updates. The title covers the central dependency upgrade. The "!" marks a breaking change, which fits the Node range change and the tar 8 API change. The title does not mention the Node version floor, but it does not need to cover every detail.

Finishing Touches

Fix failing CI checks

  • 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

A rabbit checks the tarball byte by byte
Then sends it through the extractor just right
The package folder slips away
A filter keeps some paths at bay
Tests hop through errors and success tonight

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0430360c-a1c7-4926-bc82-793ad49299da
Commits

Reviewing files that changed from the base of the PR and between 56fcff8 and 25492be.

Files ignored due to path filters: 1

  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing: 6

  • .github/workflows/npm_release_cli.yml
  • .github/workflows/tests.yml
  • lib/definitions/pacote-service.d.ts
  • lib/services/pacote-service.ts
  • package.json
  • test/services/pacote-service.ts

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

Base automatically changed from chore/npm-audit-deps to main December 4, 2026 03:52
tar 7 is affected by a set of extraction advisories (symlink escapes,
PAX header injection, memory amplification) that are fixed only in
8.x. pacote 21 and @npmcli/arborist 9 pull in sigstore, tuf-js,
npm-packlist and ignore-walk releases affected by the minimatch DoS;
pacote 22 and arborist 10 clear those.

tar 8 replaces the stream API with promises, so extractPackage passes
the tarball as the `input` option of tar.x() and awaits it. The
extractPackage tests now extract a real tarball instead of a stubbed
stream, and run instead of being skipped.

All three packages require Node ^22.22.2 || ^24.15.0 || >=26.0.0, so
the engines range, the test matrix and the release workflow move with
them. The doctor package keeps its own Node 20 leg.

BREAKING CHANGE: Node.js 20 is no longer supported. The CLI requires
Node ^22.22.2 || ^24.15.0 || >=26.0.0.
@edusperoni
edusperoni force-pushed the chore/npm11-node22-deps branch from 9e409ac to 25492be Compare December 4, 2026 03:52
@edusperoni
edusperoni marked this pull request as ready for review December 4, 2026 03:53

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant