Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ATTRIBUTIONS-Node.md
Original file line number Diff line number Diff line change
Expand Up @@ -36985,7 +36985,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
```

## tar - 7.5.21
## tar - 7.5.24

**Repository URL**: https://github.com/isaacs/node-tar
**License Type(s)**: BlueOak-1.0.0
Expand Down
16 changes: 3 additions & 13 deletions adapters/typescript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions adapters/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"pack:install-check": "node scripts/check-install.mjs",
"test": "npm run test:units && npm run test:dependencies && npm run pack:check",
"test:dependencies": "npm ls --all && node scripts/audit-dependencies.mjs",
"test:units": "node --test scripts/audit-dependencies.test.mjs && npm test --workspace nemo-fabric-adapters-common && npm test --workspace nemo-fabric-adapters-cline && npm test --workspace nemo-fabric-adapters-droid && npm test --workspace nemo-fabric-adapters-pi && npm test --workspace nemo-fabric-adapters-opencode && npm test --workspace nemo-fabric-adapters-qwen && npm test --workspace nemo-fabric-adapters-kilo && npm test --workspace nemo-fabric-adapters-kiro && npm run test --workspace nemo-fabric-adapters-strands"
"test:units": "node --test scripts/audit-dependencies.test.mjs scripts/dependency-compatibility.test.mjs && npm test --workspace nemo-fabric-adapters-common && npm test --workspace nemo-fabric-adapters-cline && npm test --workspace nemo-fabric-adapters-droid && npm test --workspace nemo-fabric-adapters-pi && npm test --workspace nemo-fabric-adapters-opencode && npm test --workspace nemo-fabric-adapters-qwen && npm test --workspace nemo-fabric-adapters-kilo && npm test --workspace nemo-fabric-adapters-kiro && npm run test --workspace nemo-fabric-adapters-strands"
},
"devDependencies": {
"nemo-fabric-adapter-contract": "file:../../adapter-contract/typescript",
Expand Down Expand Up @@ -63,7 +63,7 @@
"undici": "8.12.3"
},
"ws": "8.23.0",
"tar": "7.5.21"
"tar": "7.5.24"
},
"engines": {
"node": ">=22.19.0"
Expand Down
227 changes: 227 additions & 0 deletions adapters/typescript/scripts/audit-dependencies.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,230 @@ test("rejects a lockfile from the other TypeScript scope", () => {
assert.throws(() => checkAudit(contract.audit, adapters.lock, "contract"));
assert.throws(() => checkAudit(adapters.audit, contract.lock, "adapters"));
});

const tarNow = Date.parse("2026-12-02T12:00:00Z");
const tarDeadline = Date.parse("2026-12-10T00:00:00Z");
const tarAdvisory = {
name: "tar",
severity: "high",
url: "https://github.com/advisories/GHSA-mhqm-9wj8-w7r4",
range: "<8.0.0",
};

function tarFixture() {
const audit = structuredClone(report);
const lock = { packages: {} };
for (const [name, version, via] of [
[
"tar",
"7.5.24",
[
tarAdvisory,
{
...tarAdvisory,
url: "https://github.com/advisories/GHSA-7c32-79xj-j3jp",
range: "<8.0.2",
},
{
...tarAdvisory,
url: "https://github.com/advisories/GHSA-p96f-8xj2-g85p",
range: ">=7.0.0 <8.0.0",
severity: "moderate",
},
],
],
["pacote", "21.5.1", ["tar"]],
["node-gyp", "12.4.0", ["tar"]],
["@opencode/util", "2.0.23", ["pacote"]],
]) {
const path = `node_modules/${name}`;
audit.vulnerabilities[name] = structuredClone({
name,
severity: "high",
nodes: [path],
via,
});
lock.packages[path] = { version, dev: true };
audit.metadata.vulnerabilities.high++;
}
return { audit, lock };
}

test("tar: allows the enumerated advisories and exact development parent paths before expiry", () => {
const { audit, lock } = tarFixture();
assert.equal(checkAudit(audit, lock, "adapters", tarNow).high, 4);
assert.equal(checkAudit(audit, lock, "adapters", tarDeadline - 1).high, 4);
});

for (const now of [tarDeadline, tarDeadline + 1, NaN]) {
test(`tar: rejects an expired exception or invalid clock (${now})`, () => {
const { audit, lock } = tarFixture();
assert.throws(() => checkAudit(audit, lock, "adapters", now), /expired/);
});
}

test("tar: removing all affected findings needs no exception after expiry", () => {
assert.equal(checkAudit(report, {}, "adapters", tarDeadline).high, 0);
});

test("tar: never extends the contract audit policy", () => {
const { audit, lock } = tarFixture();
assert.throws(() => checkAudit(audit, lock, "contract", tarNow));
});

for (const [description, mutate] of [
[
"a new high advisory",
(r) =>
r.vulnerabilities.tar.via.push({
...tarAdvisory,
url: "https://github.com/advisories/OTHER",
}),
],
[
"a new moderate advisory on tar",
(r) =>
r.vulnerabilities.tar.via.push({
...tarAdvisory,
severity: "moderate",
url: "https://github.com/advisories/OTHER",
}),
],
[
"a changed advisory range",
(r) => {
r.vulnerabilities.tar.via[0].range = "*";
},
],
[
"a changed advisory name",
(r) => {
r.vulnerabilities.tar.via[0].name = "other";
},
],
[
"a changed moderate advisory severity",
(r) => {
r.vulnerabilities.tar.via[2].severity = "high";
},
],
[
"a new advisory on an approved parent",
(r) => r.vulnerabilities.pacote.via.push(tarAdvisory),
],
[
"an unknown dependency reference",
(r) => r.vulnerabilities.pacote.via.push("missing"),
],
[
"a parent cycle without tar",
(r) => {
r.vulnerabilities.pacote.via = ["@opencode/util"];
},
],
[
"a missing advisory root",
(r) => {
delete r.vulnerabilities.tar;
r.metadata.vulnerabilities.high--;
},
],
[
"a missing root advisory",
(r) => {
r.vulnerabilities.tar.via = [];
},
],
[
"an unrelated high finding",
(r) => {
r.vulnerabilities.other = {
name: "other",
severity: "high",
nodes: ["node_modules/other"],
via: ["tar"],
};
r.metadata.vulnerabilities.high++;
},
],
[
"a critical root finding",
(r) => {
r.vulnerabilities.tar.severity = "critical";
r.metadata.vulnerabilities.high--;
r.metadata.vulnerabilities.critical++;
},
],
[
"a critical advisory hidden under a high finding",
(r) => {
r.vulnerabilities.tar.via[0].severity = "critical";
},
],
[
"an audit error",
(r) => {
r.error = { code: "E503" };
},
],
[
"an inconsistent high count",
(r) => {
r.metadata.vulnerabilities.high--;
},
],
]) {
test(`tar: rejects ${description}`, () => {
const { audit, lock } = tarFixture();
mutate(audit);
assert.throws(() => checkAudit(audit, lock, "adapters", tarNow));
});
}

test("tar: rejects changed versions, missing entries, non-dev entries and additional paths for every package", () => {
const { audit, lock } = tarFixture();
for (const [path, entry] of Object.entries(lock.packages)) {
for (const replacement of [
undefined,
{ ...entry, version: "99.0.0" },
{ ...entry, dev: false },
{ version: entry.version },
]) {
const changed = structuredClone(lock);
changed.packages[path] = replacement;
assert.throws(() => checkAudit(audit, changed, "adapters", tarNow), path);
}
const changed = structuredClone(audit);
const name = path.slice("node_modules/".length);
changed.vulnerabilities[name].nodes.push(`node_modules/other/${path}`);
assert.throws(() => checkAudit(changed, lock, "adapters", tarNow), path);
}
});

test("tar: coexists with existing Zod and picomatch exceptions, including the shared node-gyp parent", () => {
const tar = tarFixture();
const picomatch = picomatchFixture("adapters");
const audit = exceptionReport();
Object.assign(
audit.vulnerabilities,
picomatch.audit.vulnerabilities,
tar.audit.vulnerabilities,
);
audit.vulnerabilities["node-gyp"].via.push("tinyglobby");
audit.vulnerabilities["@opencode/core"].via.push("@opencode/util");
audit.metadata.vulnerabilities.high = Object.values(
audit.vulnerabilities,
).filter((v) => v.severity === "high").length;
const lock = {
packages: {
...exceptionLock.packages,
...picomatch.lock.packages,
...tar.lock.packages,
},
};
assert.equal(checkAudit(audit, lock, "adapters", tarNow).high, 13);
assert.throws(
() => checkAudit(audit, lock, "adapters", tarDeadline),
/expired/,
);
});
35 changes: 35 additions & 0 deletions adapters/typescript/scripts/dependency-compatibility.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES.
// SPDX-License-Identifier: Apache-2.0

import assert from "node:assert/strict";
import { mkdtemp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { test } from "node:test";

import pacote from "pacote";
import * as tar from "tar";

test("the resolved tar supports pacote package extraction", async () => {
const root = await mkdtemp(join(tmpdir(), "fabric-pacote-"));
try {
const fixture = join(root, "package");
await mkdir(fixture);
const manifest = { name: "fabric-extraction-fixture", version: "1.0.0" };
await writeFile(join(fixture, "package.json"), JSON.stringify(manifest));
const archive = join(root, "fixture.tgz");
await tar.c({ cwd: root, file: archive, gzip: true }, ["package"]);

const destination = join(root, "extracted");
await pacote.extract(archive, destination, { cache: join(root, "cache") });
assert.deepEqual(
JSON.parse(await readFile(join(destination, "package.json"), "utf8")),
manifest,
);
} finally {
await rm(root, { recursive: true, force: true });
}
});
Loading
Loading