Skip to content

fix(security): migrate bundled npm to tar 8 - #366

Closed
beevelop wants to merge 2 commits into
latestfrom
fix/npm-bundled-tar
Closed

beevelop wants to merge 2 commits into
latestfrom
fix/npm-bundled-tar

Conversation

@beevelop

@beevelop beevelop commented Dec 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Replace the bundled npm tar 7.5.22 package with the official tar 8.1.2 archive, verified against the npm registry SHA-512 integrity value.
  • Apply a strict, version-specific patch to npm 11.21.3's archive call sites and dependency declarations. Pacote still reads through the complete input for integrity and cache handling, and node-gyp hashes the complete download before extracting it. The CLI continues to use the Node.js 24.23.0 bundle.
  • Exercise offline npm pack, npm install, npm diff, executable package bins, npm ls, and local node-gyp header extraction in the Docker workflow. Keep the existing tool and alias checks.

Validation

  • Applied the patch with zero fuzz to the npm files extracted from the official Node.js 24.23.0 archive. The hosted smoke script passed against that patched npm bundle on local Node.js 24.
  • Independently compared stock and patched npm diff output for ordinary local packages. Verified staged package download and node-gyp's complete-download checksum path with a loopback fixture server.
  • Workflow lint, shell syntax, and whitespace checks passed.
  • The hosted Docker build and archive smoke tests passed on 3af2220. GitHub Actions run

The patch is specific to npm 11.21.3 and can be removed once the upstream bundle uses tar 8. Tar 8 migration guide · Pacote migration · Bundled tar advisory

Summary by CodeRabbit

  • Improvements
    • The Docker image includes updated npm archive handling for package operations.
  • Tests
    • Added offline checks for package installation, executable entry points, package diffs, and Node.js header installation.
    • Docker image checks now verify the npm version and run the archive checks without network access.
  • Documentation
    • README now describes the bundled npm and tar versions and how to run the offline checks.

@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Docker build patches npm 11.21.3 to use tar 8.1.2. The patch updates npm archive operations, and an offline smoke test checks package packing, installation, diff output, and node-gyp header extraction.

Changes: npm tar compatibility

Layer / File(s) Summary
Adapt archive clients to tar 8.1.2
patches/npm-11.21.3-tar-8.patch
Manifest reads, tarball inspection, diffs, node-gyp header extraction, and pacote archive creation and extraction now use tar 8.1.2 interfaces. Affected packages pin tar to version 8.1.2.
Install patched npm in the Docker image
.dockerignore, Dockerfile
The build includes the npm patch, checks npm and tar versions, verifies the tar archive checksum, applies the patch, and replaces npm’s bundled tar package.
Validate and document patched npm
.github/scripts/npm-archive-smoke.sh, .github/workflows/docker.yml, README.md
The offline smoke test checks package archive operations and node-gyp header extraction. The Docker workflow runs it without networking, and the README documents the patch and test command.

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

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Smoke as npm-archive-smoke.sh
  participant npm
  participant tar as tar 8.1.2
  participant Consumer
  participant node-gyp
  Smoke->>npm: Pack local package offline
  npm->>tar: Create package archive
  Smoke->>npm: Install archive offline
  npm->>Consumer: Install package
  Smoke->>npm: Diff original and modified archives
  npm->>tar: Read archive entries
  Smoke->>node-gyp: Install local headers archive
  node-gyp->>tar: Extract headers
Loading

Possibly related PRs

Merge Risk: Minimal · up to 3af22

This change patches the Docker image's bundled npm to use tar 8.1.2 and adds an offline archive smoke test. No concrete defect was found, and the Docker build fails loudly if the npm or tar version checks, checksum, or patch application fail. It is ready to merge, subject to the CI image build and smoke test passing.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(security): migrate bundled npm to tar 8" states the main change. The changeset replaces npm 11.21.3's bundled tar 7.5.22 with tar 8.1.2 through a version-specific patch, Dockerfile chan…
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.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title "fix(security): migrate bundled npm to tar 8" states the main change. The changeset replaces npm 11.21.3's bundled tar 7.5.22 with tar 8.1.2 through a version-specific patch, Dockerfile changes, and dependency pins. The title is concise, uses a conventional-commit style, and matches the PR objectives. It does not cover the smoke-test additions, but that is expected.

Finishing Touches

Generate unit tests (beta)

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e5b640bf-e0f9-4e73-aabb-e4ee260d9d14
Commits

Reviewing files that changed from the base of the PR and between 2c799bf and 3af2220.

Files selected for processing: 6

  • .dockerignore
  • .github/scripts/npm-archive-smoke.sh
  • .github/workflows/docker.yml
  • Dockerfile
  • README.md
  • patches/npm-11.21.3-tar-8.patch

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

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