Skip to content

Moving C# coverage to 100% - #134

Merged
Mark Cowlishaw (markcowl) merged 2 commits into
Azure:devfrom
markcowl:csharp
Jun 27, 2015
Merged

Moving C# coverage to 100%#134
Mark Cowlishaw (markcowl) merged 2 commits into
Azure:devfrom
markcowl:csharp

Conversation

@markcowl

Copy link
Copy Markdown
Member

No description provided.

Mark Cowlishaw (markcowl) added a commit that referenced this pull request Jun 27, 2015
Moving C# coverage to 100%
@markcowl
Mark Cowlishaw (markcowl) merged commit 56e898e into Azure:dev Jun 27, 2015
Copilot AI mentioned this pull request Aug 5, 2026
Mike Harder (mikeharder) added a commit that referenced this pull request Aug 7, 2026
`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.

<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>


----

*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:
```js
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>

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

<references>

<url>https://github.com/isaacs/node-tar/security/advisories/GHSA-w8wr-v893-vjvp</url>
<url>https://nvd.nist.gov/vuln/detail/CVE-2026-59871</url>

<url>https://github.com/isaacs/node-tar/commit/e02a4e9e013c4be95302e2eb2047a942b883c27b</url>
<url>https://github.com/isaacs/node-tar/releases/tag/v7.5.18</url>
<url>https://github.com/advisories/GHSA-w8wr-v893-vjvp</url>
</references>

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

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Resolves Azure/autorest alert #134

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mikeharder <9459391+mikeharder@users.noreply.github.com>
Co-authored-by: Mike Harder <mharder@microsoft.com>
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