Skip to content

Commit aea3273

Browse files
committed
chore(deps): upgrade tar to 7
tar 6.2.1 carries 12 open advisories, among them CVE-2026-59873 (a decompression/parse denial of service). None of them can be reached from the `^6.2.0` range, so the range has to move to `^7.5.22`. tar 7 drops the default export and renames the streaming parser class `Parse` to `Parser`, so the install-time binary download switches to the named import and to the supported `'entry'` event -- the constructor's `onentry` option still exists in 7 but is deprecated. The entry body, the `'error'` and `'end'` listeners and the response piping are unchanged. tar 7 requires Node >= 18, which the package already declares.
1 parent 032e299 commit aea3273

3 files changed

Lines changed: 52 additions & 113 deletions

File tree

‎packages/cbjs/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"@cbjsdev/http-client": "workspace:*",
6161
"@cbjsdev/shared": "workspace:*",
6262
"hdr-histogram-js": "^3.0.1",
63-
"tar": "^6.2.0"
63+
"tar": "^7.5.22"
6464
},
6565
"devDependencies": {
6666
"@types/node": "^22.14.1",

‎packages/cbjs/scripts/utils/downloadBinary.mjs‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from 'node:fs';
22
import https from 'node:https';
3-
import tar from 'tar';
3+
import { Parser } from 'tar';
44

55
/**
66
* Build the npm registry tarball URL for a given native package.
@@ -47,22 +47,22 @@ export async function downloadBinary(
4747
);
4848
return;
4949
}
50-
50+
5151
let writeComplete;
5252

53-
const extractor = new tar.Parse({
54-
onentry: (entry) => {
55-
if (entry.path === binarySourcePath) {
56-
const output = fs.createWriteStream(binaryDestinationPath);
57-
writeComplete = new Promise((resolveWrite, rejectWrite) => {
58-
output.on('finish', resolveWrite);
59-
output.on('error', rejectWrite);
60-
});
61-
entry.pipe(output);
62-
} else {
63-
entry.resume();
64-
}
65-
},
53+
const extractor = new Parser();
54+
55+
extractor.on('entry', (entry) => {
56+
if (entry.path === binarySourcePath) {
57+
const output = fs.createWriteStream(binaryDestinationPath);
58+
writeComplete = new Promise((resolveWrite, rejectWrite) => {
59+
output.on('finish', resolveWrite);
60+
output.on('error', rejectWrite);
61+
});
62+
entry.pipe(output);
63+
} else {
64+
entry.resume();
65+
}
6666
});
6767

6868
extractor.on('error', reject);

0 commit comments

Comments
 (0)