Skip to content

Bump tar to 7.5.18 - #5202

Merged
Mike Harder (mikeharder) merged 7 commits into
mainfrom
copilot/fix-node-tar-process-crash
Aug 7, 2026
Merged

Bump tar to 7.5.18#5202
Mike Harder (mikeharder) merged 7 commits into
mainfrom
copilot/fix-node-tar-process-crash

Conversation

Copilot AI commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

tar@7.5.16 can crash Node.js while extracting crafted archives containing numeric PAX paths (CVE-2026-59871).

  • Dependency update

    • Override transitive tar resolutions to the lowest patched version, 7.5.18.
    • Regenerate pnpm-lock.yaml, removing all 7.5.16 resolutions.
  • Reachability assessment

    • Medium-high confidence: indirectly reachable through pacote, used by @azure-tools/extension and @chronus/chronus to extract package archives.
    • AutoRest does not import tar directly, but archives processed by these dependency flows can reach the affected PAX parser.
Original prompt

This section details the Dependabot vulnerability alert you should resolve

<alert_title>node-tar: Process crash via PAX numeric path type confusion</alert_title>
<alert_description>### Summary

A crafted 2.5KB tar archive crashes any Node.js process that extracts it. The PAX header parser coerces all-digit path values to JavaScript numbers, which causes an uncaught TypeError when downstream code calls .split('/') on the numeric value. Error handlers and strict: false cannot intercept the crash.

Details

In pax.ts line 180, parseKV converts PAX values matching /^[0-9]+$/ to numbers via +v. This applies to all fields including path and linkpath. When a PAX header sets path to an all-digit string like "12345", the value becomes the number 12345.

This number flows through Header -> ReadEntry -> Unpack.CHECKPATH, where normalizeWindowsPath(entry.path).split('/') throws a TypeError because numbers don't have .split().

The throw is synchronous during event emission and bypasses all error handling:

  • strict: false does not help
  • 'error' event handlers do not catch it
  • 'warn' handlers do not catch it
  • The TypeError propagates through the event emitter stack as an uncaughtException

Directory, SymbolicLink, and Link type entries reach CHECKPATH and crash. File type entries crash earlier in Header constructor at this.path.slice(-1), but that throw is caught and emitted as a warning only.

PoC

Create a tar archive with a PAX extended header containing an all-digit path:

PAX header body: "18 path=12345\n"
Entry type: Directory (type '5')

Extract it:

const tar = require('tar');

// All of these crash with TypeError: t.split is not a function
tar.extract({ file: 'malicious.tar', cwd: '/tmp/test' });

// Error handlers don't help:
tar.extract({ file: 'malicious.tar', cwd: '/tmp/test', strict: false })
  .on('error', (err) => { /* never reached */ })
  .on('warn', (code, msg) => { /* never reached */ });

The archive is ~2.5KB. The crash is deterministic on every attempt.

Impact

Denial of service. Any application or tool that extracts untrusted tar archives crashes from a single small file. This includes npm (which uses node-tar to extract packages), CI/CD pipelines, file upload processors, and backup tools. The crash cannot be caught by application-level error handling.</alert_description>

moderate
GHSA-w8wr-v893-vjvp, CVE-2026-59871
tar
npm
<vulnerable_versions>7.5.16</vulnerable_versions>
<patched_version>7.5.18</patched_version>
<manifest_path>pnpm-lock.yaml</manifest_path>

https://github.com/isaacs/node-tar/security/advisories/GHSA-w8wr-v893-vjvp https://nvd.nist.gov/vuln/detail/CVE-2026-59871 https://github.com/isaacs/node-tar/commit/e02a4e9e013c4be95302e2eb2047a942b883c27b https://github.com/isaacs/node-tar/releases/tag/v7.5.18 https://github.com/advisories/GHSA-w8wr-v893-vjvp

<task_instructions>Resolve this alert by updating the affected package to a non-vulnerable version. Prefer the lowest non-vulnerable version (see the patched_version field above) over the latest to minimize breaking changes. Include a Reachability Assessment section in the PR description. Review the alert_description field to understand which APIs, features, or configurations are affected, then search the codebase for usage of those specific items. If the vulnerable code path is reachable, explain how (which files, APIs, or call sites use the affected functionality) and note that the codebase is actively exposed to this vulnerability. If the vulnerable code path is not reachable, explain why (e.g. the affected API is never called, the vulnerable configuration is not used) and note that the update is primarily to satisfy vulnerability scanners rather than to address an active risk. If the advisory is too vague to determine reachability (e.g. 'improper input validation' with no specific API named), state that reachability could not be determined and explain why. Include a confidence level in the reachability assessment (e.g. high confidence if the advisory names a specific API and you confirmed it is or is not called, low confidence if the usage is indirect and hard to trace). If no patched version is available, check the alert_description field for a Workarounds section — the advisory may describe configuration changes or usage patterns that mitigate the vulnerability without a version update. If a workaround is available, apply it and leave a code comment referencing the advisory identifier explaining it is a temporary mitigation. If neither a patch nor a workaround is available, explain in the PR description why the alert cannot be resolved automatically so a human reviewer can take over. Inspect the repository to determine which package manager is used (e.g. lock files, config files, ...

Co-authored-by: mikeharder <9459391+mikeharder@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix node-tar process crash due to numeric path confusion Pin node-tar to patched 7.5.18 release Aug 5, 2026
@mikeharder

Copy link
Copy Markdown
Member

Copilot: do we need to add an override, or can we just update the lockfile?

Co-authored-by: mikeharder <9459391+mikeharder@users.noreply.github.com>

Copilot AI commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Copilot: do we need to add an override, or can we just update the lockfile?

The lockfile alone is sufficient: all transitive ranges accept 7.5.18, and a frozen pnpm install succeeds without the override. I removed the override in 8aaa99c; pnpm-lock.yaml still resolves only tar@7.5.18.

@mikeharder Mike Harder (mikeharder) changed the title Pin node-tar to patched 7.5.18 release Bump tar to 7.5.18 Aug 6, 2026
@mikeharder
Mike Harder (mikeharder) marked this pull request as ready for review August 6, 2026 00:09
@mikeharder
Mike Harder (mikeharder) enabled auto-merge (squash) August 6, 2026 00:10
@azure-pipelines

Copy link
Copy Markdown

You may test this build by running autorest --reset and then either:


Add the following CLI flags
Pacakge Flag Description
@autorest/core --version:https://tinyurl.com/22uo23nn For changes to autorest core.
@autorest/modelerfour --use:https://tinyurl.com/2239lltm For changes to modelerfour.

Or with all

autorest --version:https://tinyurl.com/22uo23nn --use:https://tinyurl.com/2239lltm

or use the following in your autorest configuration:
# For changes to autorest core
version: "https://tinyurl.com/22uo23nn"

# For changes to modelerfour
use-extension:
  "@autorest/modelerfour": "https://tinyurl.com/2239lltm"

If this build is good for you, give this comment a thumbs up. (👍) And you should run `autorest --reset` again once you're finished testing to remove it.

@azure-pipelines

Copy link
Copy Markdown

You may test this build by running autorest --reset and then either:


Add the following CLI flags
Pacakge Flag Description
@autorest/core --version:https://tinyurl.com/2dpwuabz For changes to autorest core.
@autorest/modelerfour --use:https://tinyurl.com/2ydxmmhx For changes to modelerfour.

Or with all

autorest --version:https://tinyurl.com/2dpwuabz --use:https://tinyurl.com/2ydxmmhx

or use the following in your autorest configuration:
# For changes to autorest core
version: "https://tinyurl.com/2dpwuabz"

# For changes to modelerfour
use-extension:
  "@autorest/modelerfour": "https://tinyurl.com/2ydxmmhx"

If this build is good for you, give this comment a thumbs up. (👍) And you should run `autorest --reset` again once you're finished testing to remove it.

@azure-pipelines

Copy link
Copy Markdown

You may test this build by running autorest --reset and then either:


Add the following CLI flags
Pacakge Flag Description
@autorest/core --version:https://tinyurl.com/276oydyn For changes to autorest core.
@autorest/modelerfour --use:https://tinyurl.com/2273jn4h For changes to modelerfour.

Or with all

autorest --version:https://tinyurl.com/276oydyn --use:https://tinyurl.com/2273jn4h

or use the following in your autorest configuration:
# For changes to autorest core
version: "https://tinyurl.com/276oydyn"

# For changes to modelerfour
use-extension:
  "@autorest/modelerfour": "https://tinyurl.com/2273jn4h"

If this build is good for you, give this comment a thumbs up. (👍) And you should run `autorest --reset` again once you're finished testing to remove it.

@azure-pipelines

Copy link
Copy Markdown

You may test this build by running autorest --reset and then either:


Add the following CLI flags
Pacakge Flag Description
@autorest/core --version:https://tinyurl.com/2845ox6s For changes to autorest core.
@autorest/modelerfour --use:https://tinyurl.com/2beubqfw For changes to modelerfour.

Or with all

autorest --version:https://tinyurl.com/2845ox6s --use:https://tinyurl.com/2beubqfw

or use the following in your autorest configuration:
# For changes to autorest core
version: "https://tinyurl.com/2845ox6s"

# For changes to modelerfour
use-extension:
  "@autorest/modelerfour": "https://tinyurl.com/2beubqfw"

If this build is good for you, give this comment a thumbs up. (👍) And you should run `autorest --reset` again once you're finished testing to remove it.

@mikeharder
Mike Harder (mikeharder) merged commit 3ce33ec into main Aug 7, 2026
11 checks passed
@mikeharder
Mike Harder (mikeharder) deleted the copilot/fix-node-tar-process-crash branch August 7, 2026 01:52
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.

3 participants