@mikeargento/bitgraph 1.9.1 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -21
- package/dist/fuse-cli.js +2 -2
- package/dist/fuse-cli.js.map +1 -1
- package/dist/fuse.d.ts +15 -1
- package/dist/fuse.d.ts.map +1 -1
- package/dist/fuse.js +29 -12
- package/dist/fuse.js.map +1 -1
- package/package.json +12 -8
- package/src/fuse-cli.ts +2 -2
- package/src/fuse.ts +46 -13
- package/dist/__tests__/audit-anchors.test.d.ts +0 -2
- package/dist/__tests__/audit-anchors.test.d.ts.map +0 -1
- package/dist/__tests__/audit-anchors.test.js +0 -152
- package/dist/__tests__/audit-anchors.test.js.map +0 -1
- package/dist/__tests__/audit-anomalies.test.d.ts +0 -2
- package/dist/__tests__/audit-anomalies.test.d.ts.map +0 -1
- package/dist/__tests__/audit-anomalies.test.js +0 -663
- package/dist/__tests__/audit-anomalies.test.js.map +0 -1
- package/dist/__tests__/audit-attestation.test.d.ts +0 -2
- package/dist/__tests__/audit-attestation.test.d.ts.map +0 -1
- package/dist/__tests__/audit-attestation.test.js +0 -403
- package/dist/__tests__/audit-attestation.test.js.map +0 -1
- package/dist/__tests__/audit-bench-smoke.test.d.ts +0 -2
- package/dist/__tests__/audit-bench-smoke.test.d.ts.map +0 -1
- package/dist/__tests__/audit-bench-smoke.test.js +0 -87
- package/dist/__tests__/audit-bench-smoke.test.js.map +0 -1
- package/dist/__tests__/audit-boundary.test.d.ts +0 -20
- package/dist/__tests__/audit-boundary.test.d.ts.map +0 -1
- package/dist/__tests__/audit-boundary.test.js +0 -84
- package/dist/__tests__/audit-boundary.test.js.map +0 -1
- package/dist/__tests__/audit-cli.test.d.ts +0 -2
- package/dist/__tests__/audit-cli.test.d.ts.map +0 -1
- package/dist/__tests__/audit-cli.test.js +0 -239
- package/dist/__tests__/audit-cli.test.js.map +0 -1
- package/dist/__tests__/audit-dependencies.test.d.ts +0 -2
- package/dist/__tests__/audit-dependencies.test.d.ts.map +0 -1
- package/dist/__tests__/audit-dependencies.test.js +0 -116
- package/dist/__tests__/audit-dependencies.test.js.map +0 -1
- package/dist/__tests__/audit-fixtures.d.ts +0 -265
- package/dist/__tests__/audit-fixtures.d.ts.map +0 -1
- package/dist/__tests__/audit-fixtures.js +0 -511
- package/dist/__tests__/audit-fixtures.js.map +0 -1
- package/dist/__tests__/audit-ingest.test.d.ts +0 -2
- package/dist/__tests__/audit-ingest.test.d.ts.map +0 -1
- package/dist/__tests__/audit-ingest.test.js +0 -473
- package/dist/__tests__/audit-ingest.test.js.map +0 -1
- package/dist/__tests__/audit-memory-ingest.test.d.ts +0 -12
- package/dist/__tests__/audit-memory-ingest.test.d.ts.map +0 -1
- package/dist/__tests__/audit-memory-ingest.test.js +0 -135
- package/dist/__tests__/audit-memory-ingest.test.js.map +0 -1
- package/dist/__tests__/audit-property.test.d.ts +0 -2
- package/dist/__tests__/audit-property.test.d.ts.map +0 -1
- package/dist/__tests__/audit-property.test.js +0 -771
- package/dist/__tests__/audit-property.test.js.map +0 -1
- package/dist/__tests__/audit-real-fixtures.test.d.ts +0 -2
- package/dist/__tests__/audit-real-fixtures.test.d.ts.map +0 -1
- package/dist/__tests__/audit-real-fixtures.test.js +0 -132
- package/dist/__tests__/audit-real-fixtures.test.js.map +0 -1
- package/dist/__tests__/audit-real-live.test.d.ts +0 -2
- package/dist/__tests__/audit-real-live.test.d.ts.map +0 -1
- package/dist/__tests__/audit-real-live.test.js +0 -107
- package/dist/__tests__/audit-real-live.test.js.map +0 -1
- package/dist/__tests__/audit-reconstruct.test.d.ts +0 -2
- package/dist/__tests__/audit-reconstruct.test.d.ts.map +0 -1
- package/dist/__tests__/audit-reconstruct.test.js +0 -287
- package/dist/__tests__/audit-reconstruct.test.js.map +0 -1
- package/dist/__tests__/audit-report.test.d.ts +0 -2
- package/dist/__tests__/audit-report.test.d.ts.map +0 -1
- package/dist/__tests__/audit-report.test.js +0 -186
- package/dist/__tests__/audit-report.test.js.map +0 -1
- package/dist/__tests__/audit-roundtrip.test.d.ts +0 -2
- package/dist/__tests__/audit-roundtrip.test.d.ts.map +0 -1
- package/dist/__tests__/audit-roundtrip.test.js +0 -368
- package/dist/__tests__/audit-roundtrip.test.js.map +0 -1
- package/dist/__tests__/audit-temporal.test.d.ts +0 -2
- package/dist/__tests__/audit-temporal.test.d.ts.map +0 -1
- package/dist/__tests__/audit-temporal.test.js +0 -364
- package/dist/__tests__/audit-temporal.test.js.map +0 -1
- package/dist/__tests__/audit-tiers.test.d.ts +0 -2
- package/dist/__tests__/audit-tiers.test.d.ts.map +0 -1
- package/dist/__tests__/audit-tiers.test.js +0 -282
- package/dist/__tests__/audit-tiers.test.js.map +0 -1
- package/dist/__tests__/audit-witness-real.test.d.ts +0 -19
- package/dist/__tests__/audit-witness-real.test.d.ts.map +0 -1
- package/dist/__tests__/audit-witness-real.test.js +0 -82
- package/dist/__tests__/audit-witness-real.test.js.map +0 -1
- package/dist/__tests__/audit-witness.test.d.ts +0 -2
- package/dist/__tests__/audit-witness.test.d.ts.map +0 -1
- package/dist/__tests__/audit-witness.test.js +0 -308
- package/dist/__tests__/audit-witness.test.js.map +0 -1
- package/dist/__tests__/canonical.test.d.ts +0 -2
- package/dist/__tests__/canonical.test.d.ts.map +0 -1
- package/dist/__tests__/canonical.test.js +0 -162
- package/dist/__tests__/canonical.test.js.map +0 -1
- package/dist/__tests__/chain-hash-anchor.test.d.ts +0 -22
- package/dist/__tests__/chain-hash-anchor.test.d.ts.map +0 -1
- package/dist/__tests__/chain-hash-anchor.test.js +0 -55
- package/dist/__tests__/chain-hash-anchor.test.js.map +0 -1
- package/dist/__tests__/commit-service.integration.test.d.ts +0 -2
- package/dist/__tests__/commit-service.integration.test.d.ts.map +0 -1
- package/dist/__tests__/commit-service.integration.test.js +0 -95
- package/dist/__tests__/commit-service.integration.test.js.map +0 -1
- package/dist/__tests__/constructor.test.d.ts +0 -2
- package/dist/__tests__/constructor.test.d.ts.map +0 -1
- package/dist/__tests__/constructor.test.js +0 -267
- package/dist/__tests__/constructor.test.js.map +0 -1
- package/dist/__tests__/declared-proof-fixture.d.ts +0 -66
- package/dist/__tests__/declared-proof-fixture.d.ts.map +0 -1
- package/dist/__tests__/declared-proof-fixture.js +0 -66
- package/dist/__tests__/declared-proof-fixture.js.map +0 -1
- package/dist/__tests__/fuse-inline.test.d.ts +0 -2
- package/dist/__tests__/fuse-inline.test.d.ts.map +0 -1
- package/dist/__tests__/fuse-inline.test.js +0 -181
- package/dist/__tests__/fuse-inline.test.js.map +0 -1
- package/dist/__tests__/fuse-placement.test.d.ts +0 -2
- package/dist/__tests__/fuse-placement.test.d.ts.map +0 -1
- package/dist/__tests__/fuse-placement.test.js +0 -31
- package/dist/__tests__/fuse-placement.test.js.map +0 -1
- package/dist/__tests__/fuse-roundtrip.test.d.ts +0 -2
- package/dist/__tests__/fuse-roundtrip.test.d.ts.map +0 -1
- package/dist/__tests__/fuse-roundtrip.test.js +0 -241
- package/dist/__tests__/fuse-roundtrip.test.js.map +0 -1
- package/dist/__tests__/fuse-sdk.test.d.ts +0 -2
- package/dist/__tests__/fuse-sdk.test.d.ts.map +0 -1
- package/dist/__tests__/fuse-sdk.test.js +0 -117
- package/dist/__tests__/fuse-sdk.test.js.map +0 -1
- package/dist/__tests__/fuse-set-sdk.test.d.ts +0 -2
- package/dist/__tests__/fuse-set-sdk.test.d.ts.map +0 -1
- package/dist/__tests__/fuse-set-sdk.test.js +0 -721
- package/dist/__tests__/fuse-set-sdk.test.js.map +0 -1
- package/dist/__tests__/fuse-set.test.d.ts +0 -2
- package/dist/__tests__/fuse-set.test.d.ts.map +0 -1
- package/dist/__tests__/fuse-set.test.js +0 -889
- package/dist/__tests__/fuse-set.test.js.map +0 -1
- package/dist/__tests__/fuse-set2.test.d.ts +0 -2
- package/dist/__tests__/fuse-set2.test.d.ts.map +0 -1
- package/dist/__tests__/fuse-set2.test.js +0 -294
- package/dist/__tests__/fuse-set2.test.js.map +0 -1
- package/dist/__tests__/fuse-vectors.test.d.ts +0 -2
- package/dist/__tests__/fuse-vectors.test.d.ts.map +0 -1
- package/dist/__tests__/fuse-vectors.test.js +0 -175
- package/dist/__tests__/fuse-vectors.test.js.map +0 -1
- package/dist/__tests__/fuse-verify.test.d.ts +0 -2
- package/dist/__tests__/fuse-verify.test.d.ts.map +0 -1
- package/dist/__tests__/fuse-verify.test.js +0 -250
- package/dist/__tests__/fuse-verify.test.js.map +0 -1
- package/dist/__tests__/hello-world.test.d.ts +0 -2
- package/dist/__tests__/hello-world.test.d.ts.map +0 -1
- package/dist/__tests__/hello-world.test.js +0 -9
- package/dist/__tests__/hello-world.test.js.map +0 -1
- package/dist/__tests__/mock-proof-fixture.d.ts +0 -15
- package/dist/__tests__/mock-proof-fixture.d.ts.map +0 -1
- package/dist/__tests__/mock-proof-fixture.js +0 -34
- package/dist/__tests__/mock-proof-fixture.js.map +0 -1
- package/dist/__tests__/policy-enforcement.test.d.ts +0 -2
- package/dist/__tests__/policy-enforcement.test.d.ts.map +0 -1
- package/dist/__tests__/policy-enforcement.test.js +0 -188
- package/dist/__tests__/policy-enforcement.test.js.map +0 -1
- package/dist/__tests__/proof-hash-regression.test.d.ts +0 -2
- package/dist/__tests__/proof-hash-regression.test.d.ts.map +0 -1
- package/dist/__tests__/proof-hash-regression.test.js +0 -95
- package/dist/__tests__/proof-hash-regression.test.js.map +0 -1
- package/dist/__tests__/proof-hash.test.d.ts +0 -2
- package/dist/__tests__/proof-hash.test.d.ts.map +0 -1
- package/dist/__tests__/proof-hash.test.js +0 -116
- package/dist/__tests__/proof-hash.test.js.map +0 -1
- package/dist/__tests__/proof-integrity.test.d.ts +0 -2
- package/dist/__tests__/proof-integrity.test.d.ts.map +0 -1
- package/dist/__tests__/proof-integrity.test.js +0 -454
- package/dist/__tests__/proof-integrity.test.js.map +0 -1
- package/dist/__tests__/realistic-proof-fixture.d.ts +0 -56
- package/dist/__tests__/realistic-proof-fixture.d.ts.map +0 -1
- package/dist/__tests__/realistic-proof-fixture.js +0 -57
- package/dist/__tests__/realistic-proof-fixture.js.map +0 -1
- package/dist/__tests__/run.test.d.ts +0 -2
- package/dist/__tests__/run.test.d.ts.map +0 -1
- package/dist/__tests__/run.test.js +0 -178
- package/dist/__tests__/run.test.js.map +0 -1
- package/dist/__tests__/verifier.test.d.ts +0 -2
- package/dist/__tests__/verifier.test.d.ts.map +0 -1
- package/dist/__tests__/verifier.test.js +0 -531
- package/dist/__tests__/verifier.test.js.map +0 -1
- package/dist/canonical.d.ts +0 -54
- package/dist/canonical.d.ts.map +0 -1
- package/dist/canonical.js +0 -119
- package/dist/canonical.js.map +0 -1
- package/dist/proof-hash.d.ts +0 -9
- package/dist/proof-hash.d.ts.map +0 -1
- package/dist/proof-hash.js +0 -75
- package/dist/proof-hash.js.map +0 -1
- package/dist/types.d.ts +0 -705
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
- package/dist/verifier.d.ts +0 -27
- package/dist/verifier.d.ts.map +0 -1
- package/dist/verifier.js +0 -844
- package/dist/verifier.js.map +0 -1
- package/src/__tests__/audit-anchors.test.ts +0 -188
- package/src/__tests__/audit-anomalies.test.ts +0 -815
- package/src/__tests__/audit-attestation.test.ts +0 -529
- package/src/__tests__/audit-bench-smoke.test.ts +0 -108
- package/src/__tests__/audit-boundary.test.ts +0 -96
- package/src/__tests__/audit-cli.test.ts +0 -288
- package/src/__tests__/audit-dependencies.test.ts +0 -141
- package/src/__tests__/audit-fixtures.ts +0 -736
- package/src/__tests__/audit-ingest.test.ts +0 -575
- package/src/__tests__/audit-memory-ingest.test.ts +0 -156
- package/src/__tests__/audit-property.test.ts +0 -892
- package/src/__tests__/audit-real-fixtures.test.ts +0 -153
- package/src/__tests__/audit-real-live.test.ts +0 -128
- package/src/__tests__/audit-reconstruct.test.ts +0 -353
- package/src/__tests__/audit-report.test.ts +0 -222
- package/src/__tests__/audit-roundtrip.test.ts +0 -464
- package/src/__tests__/audit-temporal.test.ts +0 -446
- package/src/__tests__/audit-tiers.test.ts +0 -343
- package/src/__tests__/audit-witness-real.test.ts +0 -92
- package/src/__tests__/audit-witness.test.ts +0 -345
- package/src/__tests__/canonical.test.ts +0 -253
- package/src/__tests__/chain-hash-anchor.test.ts +0 -67
- package/src/__tests__/commit-service.integration.test.ts +0 -117
- package/src/__tests__/constructor.test.ts +0 -340
- package/src/__tests__/declared-proof-fixture.ts +0 -65
- package/src/__tests__/fuse-inline.test.ts +0 -211
- package/src/__tests__/fuse-placement.test.ts +0 -32
- package/src/__tests__/fuse-roundtrip.test.ts +0 -243
- package/src/__tests__/fuse-sdk.test.ts +0 -142
- package/src/__tests__/fuse-set-sdk.test.ts +0 -852
- package/src/__tests__/fuse-set.test.ts +0 -1027
- package/src/__tests__/fuse-set2.test.ts +0 -343
- package/src/__tests__/fuse-vectors.test.ts +0 -218
- package/src/__tests__/fuse-verify.test.ts +0 -278
- package/src/__tests__/hello-world.test.ts +0 -10
- package/src/__tests__/mock-proof-fixture.ts +0 -36
- package/src/__tests__/policy-enforcement.test.ts +0 -226
- package/src/__tests__/proof-hash-regression.test.ts +0 -107
- package/src/__tests__/proof-hash.test.ts +0 -129
- package/src/__tests__/proof-integrity.test.ts +0 -576
- package/src/__tests__/real-fixtures/anchor-after-112762.json +0 -47
- package/src/__tests__/real-fixtures/anchor-with-ethereum-112758.json +0 -47
- package/src/__tests__/real-fixtures/live-proof-0.json +0 -42
- package/src/__tests__/real-fixtures/live-proof-1.json +0 -43
- package/src/__tests__/real-fixtures/live-proof-2.json +0 -43
- package/src/__tests__/real-fixtures/successor-112760.json +0 -38
- package/src/__tests__/real-fixtures/witness-25525146.json +0 -6
- package/src/__tests__/real-fixtures/witness-25525147.json +0 -6
- package/src/__tests__/realistic-proof-fixture.ts +0 -57
- package/src/__tests__/verifier.test.ts +0 -624
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Option A: a bounded proof bundle (a real export excerpt) audits CLEAN.
|
|
3
|
-
*
|
|
4
|
-
* These are the three real, contiguous proofs from an actual export of the
|
|
5
|
-
* BitGraph whitepaper: the before-anchor (112758) -> the whitepaper commit
|
|
6
|
-
* (112760) -> the after-anchor (112762). They chain intact among themselves;
|
|
7
|
-
* the only "missing" link is 112758's predecessor (112756), which precedes the
|
|
8
|
-
* exported window and is legitimately not included.
|
|
9
|
-
*
|
|
10
|
-
* Before Option A, that leading-edge gap surfaced as a `chain-break-missing`
|
|
11
|
-
* anomaly and set exit code 2, making a perfectly good proof bundle look
|
|
12
|
-
* failed. A validly signed, attested proof only exists by extending the chain
|
|
13
|
-
* (fail-closed construction), so the excerpt boundary is expected, not a
|
|
14
|
-
* defect. The audit now records it as an informational boundary entry point:
|
|
15
|
-
* zero anomalies, chain intact, exit 0. Interior holes remain anomalies (see
|
|
16
|
-
* audit-anomalies "missing middle" / "missing head"), so this does not weaken
|
|
17
|
-
* full-epoch auditing.
|
|
18
|
-
*/
|
|
19
|
-
export {};
|
|
20
|
-
//# sourceMappingURL=audit-boundary.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audit-boundary.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/audit-boundary.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Option A: a bounded proof bundle (a real export excerpt) audits CLEAN.
|
|
3
|
-
*
|
|
4
|
-
* These are the three real, contiguous proofs from an actual export of the
|
|
5
|
-
* BitGraph whitepaper: the before-anchor (112758) -> the whitepaper commit
|
|
6
|
-
* (112760) -> the after-anchor (112762). They chain intact among themselves;
|
|
7
|
-
* the only "missing" link is 112758's predecessor (112756), which precedes the
|
|
8
|
-
* exported window and is legitimately not included.
|
|
9
|
-
*
|
|
10
|
-
* Before Option A, that leading-edge gap surfaced as a `chain-break-missing`
|
|
11
|
-
* anomaly and set exit code 2, making a perfectly good proof bundle look
|
|
12
|
-
* failed. A validly signed, attested proof only exists by extending the chain
|
|
13
|
-
* (fail-closed construction), so the excerpt boundary is expected, not a
|
|
14
|
-
* defect. The audit now records it as an informational boundary entry point:
|
|
15
|
-
* zero anomalies, chain intact, exit 0. Interior holes remain anomalies (see
|
|
16
|
-
* audit-anomalies "missing middle" / "missing head"), so this does not weaken
|
|
17
|
-
* full-epoch auditing.
|
|
18
|
-
*/
|
|
19
|
-
import { describe, it, before, after } from "node:test";
|
|
20
|
-
import * as assert from "node:assert/strict";
|
|
21
|
-
import { mkdtemp, mkdir, writeFile, rm, readFile } from "node:fs/promises";
|
|
22
|
-
import { tmpdir } from "node:os";
|
|
23
|
-
import { join } from "node:path";
|
|
24
|
-
import { fileURLToPath } from "node:url";
|
|
25
|
-
import { runAudit, buildJsonReport, computeExitFlags, } from "@mikeargento/bitgraph-audit";
|
|
26
|
-
import { computeProofHash } from "@mikeargento/bitgraph-verify";
|
|
27
|
-
function safe(value) {
|
|
28
|
-
return value.replace(/[^A-Za-z0-9]/g, "_");
|
|
29
|
-
}
|
|
30
|
-
describe("audit: bounded export excerpt is clean (Option A boundary)", () => {
|
|
31
|
-
let dir;
|
|
32
|
-
let result;
|
|
33
|
-
let proofs;
|
|
34
|
-
before(async () => {
|
|
35
|
-
proofs = [];
|
|
36
|
-
for (const name of [
|
|
37
|
-
"anchor-with-ethereum-112758.json",
|
|
38
|
-
"successor-112760.json",
|
|
39
|
-
"anchor-after-112762.json",
|
|
40
|
-
]) {
|
|
41
|
-
const url = new URL(`../../src/__tests__/real-fixtures/${name}`, import.meta.url);
|
|
42
|
-
proofs.push(JSON.parse(await readFile(fileURLToPath(url), "utf8")));
|
|
43
|
-
}
|
|
44
|
-
dir = await mkdtemp(join(tmpdir(), "bitgraph-audit-boundary-"));
|
|
45
|
-
for (const proof of proofs) {
|
|
46
|
-
const epochDir = join(dir, "proofs", safe(proof.commit.epochId));
|
|
47
|
-
await mkdir(epochDir, { recursive: true });
|
|
48
|
-
const fileName = `${proof.commit.counter}-${safe(computeProofHash(proof))}.json`;
|
|
49
|
-
await writeFile(join(epochDir, fileName), JSON.stringify(proof));
|
|
50
|
-
}
|
|
51
|
-
result = await runAudit(dir);
|
|
52
|
-
});
|
|
53
|
-
after(async () => {
|
|
54
|
-
if (dir !== undefined)
|
|
55
|
-
await rm(dir, { recursive: true, force: true });
|
|
56
|
-
});
|
|
57
|
-
it("reconstructs the excerpt as one intact chain with no anomalies", () => {
|
|
58
|
-
const report = buildJsonReport(result);
|
|
59
|
-
assert.equal(result.ingest.counts.observed, 3);
|
|
60
|
-
assert.equal(result.reconstruction.partitions.length, 1);
|
|
61
|
-
assert.equal(result.reconstruction.partitions[0].components.length, 1);
|
|
62
|
-
assert.equal(result.anomalies.anomalies.length, 0);
|
|
63
|
-
assert.equal(result.anomalies.divergences.length, 0);
|
|
64
|
-
assert.equal(report.summary.chainIntact, true);
|
|
65
|
-
assert.equal(report.summary.partitionsIntact, 1);
|
|
66
|
-
});
|
|
67
|
-
it("records exactly one boundary entry point: the excerpt's earliest proof (112758)", () => {
|
|
68
|
-
const report = buildJsonReport(result);
|
|
69
|
-
assert.equal(report.summary.boundaryEntryPoints, 1);
|
|
70
|
-
assert.equal(report.boundaryEntryPoints.length, 1);
|
|
71
|
-
const boundary = report.boundaryEntryPoints[0];
|
|
72
|
-
const earliest = proofs.find((p) => p.commit.counter === "112758");
|
|
73
|
-
assert.equal(boundary.proofHash, computeProofHash(earliest));
|
|
74
|
-
assert.equal(boundary.prevB64, earliest.commit.prevB64);
|
|
75
|
-
});
|
|
76
|
-
it("exits clean (code 0): a bounded excerpt is not a failure", () => {
|
|
77
|
-
assert.deepEqual(computeExitFlags(result), {
|
|
78
|
-
verificationFailures: false,
|
|
79
|
-
chainAnomaliesOrDivergences: false,
|
|
80
|
-
code: 0,
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
//# sourceMappingURL=audit-boundary.test.js.map
|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AA0D,EAAE,GAAG,EAAE;QAClE,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE;YACzC,oBAAoB,EAAE,KAAK;YAC3B,2BAA2B,EAAE,KAAK;YAClC,IAAI,EAAE,CAAC;SACR,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audit-cli.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/audit-cli.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Argento Computing Inc. All rights reserved. See LICENSE.
|
|
2
|
-
/**
|
|
3
|
-
* Tests for the bitgraph-audit CLI: spawns the built packages/audit
|
|
4
|
-
* dist/cli.js with node against temp-dir bundles and asserts the written
|
|
5
|
-
* report files, the bit-flag exit codes (0 clean, 1 verification
|
|
6
|
-
* failures including unsupported-version, 2 chain anomalies or
|
|
7
|
-
* divergences, 3 both, 64 usage error), format selection, trust-policy
|
|
8
|
-
* key validation, and the --help exit-code documentation.
|
|
9
|
-
*/
|
|
10
|
-
import { describe, it, before, after } from "node:test";
|
|
11
|
-
import * as assert from "node:assert/strict";
|
|
12
|
-
import { spawnSync } from "node:child_process";
|
|
13
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
14
|
-
import { rm, writeFile } from "node:fs/promises";
|
|
15
|
-
import { join } from "node:path";
|
|
16
|
-
import { fileURLToPath } from "node:url";
|
|
17
|
-
import { healthyPairs, makeAnchorProof, makeCounterChain, makeEthereumHeader, makeStandardAuditBundle, makeTempDir, proofJson, signBody, utf8, witnessJson, writeBundleDir, b64, } from "./audit-fixtures.js";
|
|
18
|
-
import { sha256 } from "@noble/hashes/sha256";
|
|
19
|
-
import { keccak_256 } from "@noble/hashes/sha3";
|
|
20
|
-
import { computeProofHash } from "@mikeargento/bitgraph-verify";
|
|
21
|
-
const CLI_PATH = fileURLToPath(new URL("../../packages/audit/dist/cli.js", import.meta.url));
|
|
22
|
-
function runCli(args) {
|
|
23
|
-
const spawned = spawnSync(process.execPath, [CLI_PATH, ...args], { encoding: "utf8" });
|
|
24
|
-
return {
|
|
25
|
-
status: spawned.status ?? -1,
|
|
26
|
-
stdout: spawned.stdout ?? "",
|
|
27
|
-
stderr: spawned.stderr ?? "",
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
describe("bitgraph-audit CLI", () => {
|
|
31
|
-
const tempDirs = [];
|
|
32
|
-
let mixed;
|
|
33
|
-
let cleanDir;
|
|
34
|
-
let rejectOnlyDir;
|
|
35
|
-
let forkOnlyDir;
|
|
36
|
-
before(async () => {
|
|
37
|
-
// Mixed bundle: gap + fork (bit 2) and an occ/1 reject (bit 1).
|
|
38
|
-
mixed = await makeStandardAuditBundle();
|
|
39
|
-
tempDirs.push(mixed.dir);
|
|
40
|
-
// Clean bundle: healthy chain with every artifact present.
|
|
41
|
-
cleanDir = await makeTempDir("bitgraph-audit-cli-clean-");
|
|
42
|
-
tempDirs.push(cleanDir);
|
|
43
|
-
const clean = await makeCounterChain({
|
|
44
|
-
epochId: "epoch-cli-clean",
|
|
45
|
-
pairs: healthyPairs(2),
|
|
46
|
-
chainId: "bitgraph:main",
|
|
47
|
-
payloadPrefix: "cli-clean",
|
|
48
|
-
});
|
|
49
|
-
await writeBundleDir(cleanDir, {
|
|
50
|
-
"proofs/a.json": proofJson(clean.proofs[0].proof),
|
|
51
|
-
"proofs/b.json": proofJson(clean.proofs[1].proof),
|
|
52
|
-
"artifacts/a.bin": clean.proofs[0].bytes,
|
|
53
|
-
"artifacts/b.bin": clean.proofs[1].bytes,
|
|
54
|
-
});
|
|
55
|
-
// Reject-only bundle: a single occ/1 proof-shaped file.
|
|
56
|
-
rejectOnlyDir = await makeTempDir("bitgraph-audit-cli-reject-");
|
|
57
|
-
tempDirs.push(rejectOnlyDir);
|
|
58
|
-
await writeBundleDir(rejectOnlyDir, {
|
|
59
|
-
"old.json": JSON.stringify({
|
|
60
|
-
version: "occ/1",
|
|
61
|
-
artifact: { hashAlg: "sha256", digestB64: "b2NjLWxlZ2FjeQ==" },
|
|
62
|
-
commit: { nonceB64: "b2NjLW5vbmNl" },
|
|
63
|
-
signer: { publicKeyB64: "b2NjLWtleQ==", signatureB64: "b2NjLXNpZw==" },
|
|
64
|
-
}),
|
|
65
|
-
});
|
|
66
|
-
// Fork-only bundle: valid proofs, one predecessor consumed twice.
|
|
67
|
-
forkOnlyDir = await makeTempDir("bitgraph-audit-cli-fork-");
|
|
68
|
-
tempDirs.push(forkOnlyDir);
|
|
69
|
-
const base = await makeCounterChain({
|
|
70
|
-
epochId: "epoch-cli-fork",
|
|
71
|
-
pairs: healthyPairs(2),
|
|
72
|
-
chainId: "bitgraph:main",
|
|
73
|
-
payloadPrefix: "cli-fork",
|
|
74
|
-
});
|
|
75
|
-
const tail = base.proofs[1];
|
|
76
|
-
const forkChild = async (slot, commit, payload) => {
|
|
77
|
-
const bytes = utf8(payload);
|
|
78
|
-
const commitBody = {
|
|
79
|
-
nonceB64: b64(crypto.getRandomValues(new Uint8Array(16))),
|
|
80
|
-
counter: commit,
|
|
81
|
-
slotCounter: slot,
|
|
82
|
-
prevB64: tail.chainHash,
|
|
83
|
-
epochId: "epoch-cli-fork",
|
|
84
|
-
};
|
|
85
|
-
commitBody["chainId"] = "bitgraph:main";
|
|
86
|
-
const proof = await signBody(base.key, { hashAlg: "sha256", digestB64: b64(sha256(bytes)) }, commitBody, "test-measurement-chain");
|
|
87
|
-
return { proof, proofHash: computeProofHash(proof) };
|
|
88
|
-
};
|
|
89
|
-
const childA = await forkChild("5", "6", "cli-fork-a");
|
|
90
|
-
const childB = await forkChild("7", "8", "cli-fork-b");
|
|
91
|
-
await writeBundleDir(forkOnlyDir, {
|
|
92
|
-
"proofs/base-0.json": proofJson(base.proofs[0].proof),
|
|
93
|
-
"proofs/base-1.json": proofJson(tail.proof),
|
|
94
|
-
"proofs/fork-a.json": proofJson(childA.proof),
|
|
95
|
-
"proofs/fork-b.json": proofJson(childB.proof),
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
after(async () => {
|
|
99
|
-
for (const dir of tempDirs)
|
|
100
|
-
await rm(dir, { recursive: true, force: true });
|
|
101
|
-
});
|
|
102
|
-
it("exits 3 on the mixed bundle and writes both report files", async () => {
|
|
103
|
-
const outDir = await makeTempDir("bitgraph-audit-cli-out-mixed-");
|
|
104
|
-
tempDirs.push(outDir);
|
|
105
|
-
const run = runCli([mixed.dir, "--out", outDir]);
|
|
106
|
-
assert.equal(run.status, 3, run.stderr);
|
|
107
|
-
const jsonPath = join(outDir, "audit-report.json");
|
|
108
|
-
const mdPath = join(outDir, "audit-report.md");
|
|
109
|
-
assert.ok(existsSync(jsonPath), "audit-report.json written");
|
|
110
|
-
assert.ok(existsSync(mdPath), "audit-report.md written");
|
|
111
|
-
// stdout: the short completion line names the files and the exit meaning.
|
|
112
|
-
assert.ok(run.stdout.includes("audit-report.json"));
|
|
113
|
-
assert.ok(run.stdout.includes("audit-report.md"));
|
|
114
|
-
assert.ok(run.stdout.includes("exit 3"));
|
|
115
|
-
assert.ok(run.stdout.includes("verification failures"));
|
|
116
|
-
assert.ok(run.stdout.includes("chain anomalies"));
|
|
117
|
-
// The written JSON is the real report.
|
|
118
|
-
const written = JSON.parse(readFileSync(jsonPath, "utf8"));
|
|
119
|
-
assert.equal(written.reportSchemaVersion, "bitgraph-audit-report/2");
|
|
120
|
-
assert.equal(written.summary.exit.code, 3);
|
|
121
|
-
// No em dashes in either written file.
|
|
122
|
-
assert.ok(!readFileSync(jsonPath, "utf8").includes("—"));
|
|
123
|
-
assert.ok(!readFileSync(mdPath, "utf8").includes("—"));
|
|
124
|
-
});
|
|
125
|
-
it("exits 0 on a clean chain-only bundle", async () => {
|
|
126
|
-
const outDir = await makeTempDir("bitgraph-audit-cli-out-clean-");
|
|
127
|
-
tempDirs.push(outDir);
|
|
128
|
-
const run = runCli([cleanDir, "--out", outDir]);
|
|
129
|
-
assert.equal(run.status, 0, run.stderr);
|
|
130
|
-
assert.ok(run.stdout.includes("exit 0"));
|
|
131
|
-
assert.ok(run.stdout.includes("clean"));
|
|
132
|
-
assert.ok(existsSync(join(outDir, "audit-report.json")));
|
|
133
|
-
assert.ok(existsSync(join(outDir, "audit-report.md")));
|
|
134
|
-
});
|
|
135
|
-
it("exits 1 on a reject-only bundle (unsupported-version counts as verification failure)", async () => {
|
|
136
|
-
const outDir = await makeTempDir("bitgraph-audit-cli-out-reject-");
|
|
137
|
-
tempDirs.push(outDir);
|
|
138
|
-
const run = runCli([rejectOnlyDir, "--out", outDir]);
|
|
139
|
-
assert.equal(run.status, 1, run.stderr);
|
|
140
|
-
assert.ok(run.stdout.includes("exit 1"));
|
|
141
|
-
});
|
|
142
|
-
it("exits 2 on a fork-only bundle (divergence between valid proofs)", async () => {
|
|
143
|
-
const outDir = await makeTempDir("bitgraph-audit-cli-out-fork-");
|
|
144
|
-
tempDirs.push(outDir);
|
|
145
|
-
const run = runCli([forkOnlyDir, "--out", outDir]);
|
|
146
|
-
assert.equal(run.status, 2, run.stderr);
|
|
147
|
-
assert.ok(run.stdout.includes("exit 2"));
|
|
148
|
-
});
|
|
149
|
-
it("exits 2 on a bundle whose anchor witness fails offline verification", async () => {
|
|
150
|
-
const witnessDir = await makeTempDir("bitgraph-audit-cli-witness-");
|
|
151
|
-
tempDirs.push(witnessDir);
|
|
152
|
-
const blockNumber = 555000;
|
|
153
|
-
// The anchor commits the hash of the correct header; the witness carries
|
|
154
|
-
// a tampered header (different timestamp, so a different keccak hash)
|
|
155
|
-
// while claiming the correct block hash, so it still matches the anchor
|
|
156
|
-
// and fails loudly at the hash step instead of disappearing as unmatched.
|
|
157
|
-
const correct = makeEthereumHeader({ blockNumber, timestamp: 1_700_000_000 });
|
|
158
|
-
const correctHash = `0x${Buffer.from(keccak_256(correct.headerBytes)).toString("hex")}`;
|
|
159
|
-
const tampered = makeEthereumHeader({ blockNumber, timestamp: 1_699_999_999 });
|
|
160
|
-
const anchor = await makeAnchorProof({
|
|
161
|
-
blockHash: correctHash,
|
|
162
|
-
blockNumber,
|
|
163
|
-
epochId: "epoch-cli-witness",
|
|
164
|
-
counter: "2",
|
|
165
|
-
slotCounter: "1",
|
|
166
|
-
});
|
|
167
|
-
await writeBundleDir(witnessDir, {
|
|
168
|
-
"proofs/anchor.json": proofJson(anchor.proof),
|
|
169
|
-
"witnesses/block.json": witnessJson({
|
|
170
|
-
headerRlpHex: tampered.headerRlpHex,
|
|
171
|
-
blockNumber,
|
|
172
|
-
blockHash: correctHash,
|
|
173
|
-
}),
|
|
174
|
-
});
|
|
175
|
-
const outDir = await makeTempDir("bitgraph-audit-cli-out-witness-");
|
|
176
|
-
tempDirs.push(outDir);
|
|
177
|
-
const run = runCli([witnessDir, "--out", outDir]);
|
|
178
|
-
// The anchor itself verifies (no bytes: artifact-unavailable, not a
|
|
179
|
-
// failure), so bit 1 stays clear; the witness verification failure sets
|
|
180
|
-
// bit 2. Before the fix this bundle exited 0 "clean".
|
|
181
|
-
assert.equal(run.status, 2, run.stderr);
|
|
182
|
-
assert.ok(run.stdout.includes("exit 2"));
|
|
183
|
-
assert.ok(run.stdout.includes("anchor witness verification failures"));
|
|
184
|
-
const report = JSON.parse(readFileSync(join(outDir, "audit-report.json"), "utf8"));
|
|
185
|
-
assert.equal(report.summary.exit.code, 2);
|
|
186
|
-
assert.ok((report.summary.anomalyCountsByCode["witness-hash-mismatch"] ?? 0) >= 1);
|
|
187
|
-
});
|
|
188
|
-
it("exits 1 when a supplied policy makes bytes-free proofs fail (requireSlot)", async () => {
|
|
189
|
-
const outDir = await makeTempDir("bitgraph-audit-cli-out-policy-");
|
|
190
|
-
tempDirs.push(outDir);
|
|
191
|
-
const policyPath = join(outDir, "policy.json");
|
|
192
|
-
await writeFile(policyPath, JSON.stringify({ requireSlot: true }), "utf8");
|
|
193
|
-
// Fork-only proofs carry no slotAllocation record, so requireSlot
|
|
194
|
-
// fails them; the divergence keeps bit 2 set as well.
|
|
195
|
-
const run = runCli([forkOnlyDir, "--out", outDir, "--trust-policy", policyPath]);
|
|
196
|
-
assert.equal(run.status, 3, run.stderr);
|
|
197
|
-
});
|
|
198
|
-
it("writes only JSON with --format json", async () => {
|
|
199
|
-
const outDir = await makeTempDir("bitgraph-audit-cli-out-json-");
|
|
200
|
-
tempDirs.push(outDir);
|
|
201
|
-
const run = runCli([cleanDir, "--out", outDir, "--format", "json"]);
|
|
202
|
-
assert.equal(run.status, 0, run.stderr);
|
|
203
|
-
assert.ok(existsSync(join(outDir, "audit-report.json")));
|
|
204
|
-
assert.ok(!existsSync(join(outDir, "audit-report.md")));
|
|
205
|
-
assert.ok(!run.stdout.includes("audit-report.md"));
|
|
206
|
-
});
|
|
207
|
-
it("rejects an unknown trust-policy key with usage and the valid field list", async () => {
|
|
208
|
-
const outDir = await makeTempDir("bitgraph-audit-cli-out-badpolicy-");
|
|
209
|
-
tempDirs.push(outDir);
|
|
210
|
-
const policyPath = join(outDir, "bad-policy.json");
|
|
211
|
-
await writeFile(policyPath, JSON.stringify({ requireBytes: true }), "utf8");
|
|
212
|
-
const run = runCli([cleanDir, "--out", outDir, "--trust-policy", policyPath]);
|
|
213
|
-
assert.equal(run.status, 64);
|
|
214
|
-
assert.ok(run.stderr.includes("requireBytes"), "names the unknown key");
|
|
215
|
-
assert.ok(run.stderr.includes("allowedMeasurements"), "lists the valid keys");
|
|
216
|
-
assert.ok(run.stderr.includes("requireSlot"), "lists the valid keys");
|
|
217
|
-
assert.ok(run.stderr.includes("Usage:"), "prints usage");
|
|
218
|
-
assert.ok(!existsSync(join(outDir, "audit-report.json")), "no report on usage error");
|
|
219
|
-
});
|
|
220
|
-
it("documents the exit-code semantics in --help", () => {
|
|
221
|
-
const run = runCli(["--help"]);
|
|
222
|
-
assert.equal(run.status, 0);
|
|
223
|
-
assert.ok(run.stdout.includes("Exit codes (bit flags):"));
|
|
224
|
-
for (const marker of ["0 ", "1 ", "2 ", "3 ", "64"]) {
|
|
225
|
-
assert.ok(run.stdout.includes(` ${marker}`), `documents exit code ${marker.trim()}`);
|
|
226
|
-
}
|
|
227
|
-
assert.ok(run.stdout.includes("unsupported version"));
|
|
228
|
-
assert.ok(run.stdout.includes("NOT a failure"));
|
|
229
|
-
assert.ok(run.stdout.includes("Attestation validation results"));
|
|
230
|
-
assert.ok(!run.stdout.includes("—"), "help text contains no em dashes");
|
|
231
|
-
});
|
|
232
|
-
it("errors with usage when no bundle path is given", () => {
|
|
233
|
-
const run = runCli([]);
|
|
234
|
-
assert.equal(run.status, 64);
|
|
235
|
-
assert.ok(run.stderr.includes("missing bundle path"));
|
|
236
|
-
assert.ok(run.stderr.includes("Usage:"));
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
//# sourceMappingURL=audit-cli.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audit-cli.test.js","sourceRoot":"","sources":["../../src/__tests__/audit-cli.test.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAEzE;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,WAAW,EACX,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,cAAc,EACd,GAAG,GAEJ,MAAM,qBAA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AE,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC;QAChD,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,gCAAgC,CAAC,CAAC,CAAC;QACjE,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,iCAAiC,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;QACvB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC7B,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAAC;QACtD,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audit-dependencies.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/audit-dependencies.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Argento Computing Inc. All rights reserved. See LICENSE.
|
|
2
|
-
/**
|
|
3
|
-
* Dependency audit for @mikeargento/bitgraph-audit (Phase 4e).
|
|
4
|
-
*
|
|
5
|
-
* The audit package promises zero runtime network access. This suite pins
|
|
6
|
-
* that promise mechanically:
|
|
7
|
-
*
|
|
8
|
-
* 1. The declared runtime dependency closure is exactly
|
|
9
|
-
* @mikeargento/bitgraph-verify plus @noble/hashes, with
|
|
10
|
-
* @noble/ed25519 arriving only transitively through verify. Nothing
|
|
11
|
-
* else, and no peer or optional dependencies that could widen it.
|
|
12
|
-
* 2. An fs walk of the shipped module graphs (packages/audit/dist and
|
|
13
|
-
* packages/verify/dist, which is inside the runtime closure) asserts
|
|
14
|
-
* no compiled file references node:http, node:https, node:net,
|
|
15
|
-
* node:dgram, node:tls, XMLHttpRequest, WebSocket, a bare
|
|
16
|
-
* http/https/net/tls/dgram import, or a global fetch call.
|
|
17
|
-
*
|
|
18
|
-
* The @noble packages were audited by hand and recorded in DECISIONS.md:
|
|
19
|
-
* pure crypto, no network APIs. (@noble/hashes sha3-addons defines a hash
|
|
20
|
-
* CLASS METHOD named fetch for XOF output; it is not the global fetch and
|
|
21
|
-
* the audit package does not import sha3-addons.)
|
|
22
|
-
*/
|
|
23
|
-
import { describe, it } from "node:test";
|
|
24
|
-
import * as assert from "node:assert/strict";
|
|
25
|
-
import { readFile, readdir } from "node:fs/promises";
|
|
26
|
-
import { fileURLToPath } from "node:url";
|
|
27
|
-
import { join } from "node:path";
|
|
28
|
-
// Compiled location: <repo>/dist/__tests__/audit-dependencies.test.js
|
|
29
|
-
const repoRoot = fileURLToPath(new URL("../..", import.meta.url));
|
|
30
|
-
async function walkJsFiles(dir) {
|
|
31
|
-
const out = [];
|
|
32
|
-
const entries = await readdir(dir, { withFileTypes: true });
|
|
33
|
-
entries.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
34
|
-
for (const entry of entries) {
|
|
35
|
-
const abs = join(dir, entry.name);
|
|
36
|
-
if (entry.isDirectory()) {
|
|
37
|
-
out.push(...(await walkJsFiles(abs)));
|
|
38
|
-
}
|
|
39
|
-
else if (entry.isFile() && entry.name.endsWith(".js")) {
|
|
40
|
-
out.push(abs);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return out;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Forbidden references. Substring checks for the node: specifiers and the
|
|
47
|
-
* browser network globals (these strings have no legitimate reason to
|
|
48
|
-
* appear anywhere in the compiled output, comments included), plus
|
|
49
|
-
* pattern checks for bare-specifier network imports and global fetch
|
|
50
|
-
* calls.
|
|
51
|
-
*/
|
|
52
|
-
const FORBIDDEN_SUBSTRINGS = [
|
|
53
|
-
"node:http",
|
|
54
|
-
"node:https",
|
|
55
|
-
"node:net",
|
|
56
|
-
"node:dgram",
|
|
57
|
-
"node:tls",
|
|
58
|
-
"XMLHttpRequest",
|
|
59
|
-
"WebSocket",
|
|
60
|
-
];
|
|
61
|
-
const FORBIDDEN_PATTERNS = [
|
|
62
|
-
["bare network import", /(?:from\s*|require\s*\(\s*|import\s*\(\s*)["'](?:http|https|net|tls|dgram)["']/],
|
|
63
|
-
["global fetch call", /\bfetch\s*\(/],
|
|
64
|
-
];
|
|
65
|
-
async function assertGraphClean(distDir) {
|
|
66
|
-
const files = await walkJsFiles(distDir);
|
|
67
|
-
assert.ok(files.length > 0, `compiled module graph exists at ${distDir} (run the build first)`);
|
|
68
|
-
for (const file of files) {
|
|
69
|
-
const source = await readFile(file, "utf8");
|
|
70
|
-
for (const needle of FORBIDDEN_SUBSTRINGS) {
|
|
71
|
-
assert.ok(!source.includes(needle), `${file} must not reference ${needle}`);
|
|
72
|
-
}
|
|
73
|
-
for (const [name, pattern] of FORBIDDEN_PATTERNS) {
|
|
74
|
-
assert.ok(!pattern.test(source), `${file} must not contain a ${name}`);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return files.length;
|
|
78
|
-
}
|
|
79
|
-
describe("audit package dependency audit: zero network surface", () => {
|
|
80
|
-
it("declares exactly the allowed runtime dependency closure", async () => {
|
|
81
|
-
const auditPkg = JSON.parse(await readFile(join(repoRoot, "packages", "audit", "package.json"), "utf8"));
|
|
82
|
-
const verifyPkg = JSON.parse(await readFile(join(repoRoot, "packages", "verify", "package.json"), "utf8"));
|
|
83
|
-
assert.deepEqual(Object.keys(auditPkg["dependencies"] ?? {}).sort(), ["@mikeargento/bitgraph-verify", "@noble/hashes"], "audit runtime dependencies are exactly verify + @noble/hashes");
|
|
84
|
-
assert.deepEqual(Object.keys(verifyPkg["dependencies"] ?? {}).sort(), ["@noble/ed25519", "@noble/hashes"], "verify (the only workspace dependency) brings exactly the @noble crypto pair");
|
|
85
|
-
// No side doors that could widen the closure at install time.
|
|
86
|
-
for (const [pkgName, pkg] of [
|
|
87
|
-
["audit", auditPkg],
|
|
88
|
-
["verify", verifyPkg],
|
|
89
|
-
]) {
|
|
90
|
-
assert.equal(pkg["peerDependencies"], undefined, `${pkgName} has no peerDependencies`);
|
|
91
|
-
assert.equal(pkg["optionalDependencies"], undefined, `${pkgName} has no optionalDependencies`);
|
|
92
|
-
assert.equal(pkg["bundledDependencies"], undefined, `${pkgName} has no bundledDependencies`);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
it("packages/audit/dist references no network API", async () => {
|
|
96
|
-
const count = await assertGraphClean(join(repoRoot, "packages", "audit", "dist"));
|
|
97
|
-
assert.ok(count >= 15, `walked the full audit module graph (${count} files)`);
|
|
98
|
-
});
|
|
99
|
-
it("packages/verify/dist (runtime closure member) references no network API", async () => {
|
|
100
|
-
const count = await assertGraphClean(join(repoRoot, "packages", "verify", "dist"));
|
|
101
|
-
assert.ok(count >= 4, `walked the full verify module graph (${count} files)`);
|
|
102
|
-
});
|
|
103
|
-
it("README ships resolvable doc links (absolute GitHub URLs, never repo-relative)", async () => {
|
|
104
|
-
// README.md is in the package "files" allowlist but docs/ is not, so
|
|
105
|
-
// repo-relative doc links would be dead on npmjs.com. They must be
|
|
106
|
-
// absolute GitHub URLs.
|
|
107
|
-
const readme = await readFile(join(repoRoot, "packages", "audit", "README.md"), "utf8");
|
|
108
|
-
const base = "https://github.com/mikeargento/bitgraph/blob/main/docs";
|
|
109
|
-
assert.ok(readme.includes(`${base}/BUNDLE-FORMAT.md`), "BUNDLE-FORMAT.md link is absolute");
|
|
110
|
-
assert.ok(readme.includes(`${base}/HOW-TO-AUDIT.md`), "HOW-TO-AUDIT.md link is absolute");
|
|
111
|
-
// No markdown link target resolves to a repo-relative docs path.
|
|
112
|
-
assert.ok(!/\]\(docs\//.test(readme), "no repo-relative docs/ link targets");
|
|
113
|
-
assert.ok(!/\]\(\.{1,2}\/.*docs\//.test(readme), "no relative docs/ link targets");
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
//# sourceMappingURL=audit-dependencies.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audit-dependencies.test.js","sourceRoot":"","sources":["../../src/__tests__/audit-dependencies.test.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAEzE;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,sEAAsE;AACtE,MAAM,QAAQ,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAElE,KAAK,UAAU,WAAW,CAAC,GAAW;IACpC,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzE,KAAK,MAAM,K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