attenu-guard 0.10.0 → 0.12.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/CHANGELOG.md +12 -0
- package/dist/cjs/authority.d.ts.map +1 -1
- package/dist/cjs/authority.js +87 -1
- package/dist/cjs/authority.js.map +1 -1
- package/dist/cjs/cli.d.ts +5 -2
- package/dist/cjs/cli.d.ts.map +1 -1
- package/dist/cjs/cli.js +13 -2
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/evidence.d.ts +6 -0
- package/dist/cjs/evidence.d.ts.map +1 -1
- package/dist/cjs/evidence.js +38 -0
- package/dist/cjs/evidence.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wire.d.ts.map +1 -1
- package/dist/cjs/wire.js +42 -0
- package/dist/cjs/wire.js.map +1 -1
- package/dist/esm/authority.d.ts.map +1 -1
- package/dist/esm/authority.js +88 -2
- package/dist/esm/authority.js.map +1 -1
- package/dist/esm/cli.d.ts +5 -2
- package/dist/esm/cli.d.ts.map +1 -1
- package/dist/esm/cli.js +13 -2
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/evidence.d.ts +6 -0
- package/dist/esm/evidence.d.ts.map +1 -1
- package/dist/esm/evidence.js +38 -0
- package/dist/esm/evidence.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wire.d.ts.map +1 -1
- package/dist/esm/wire.js +42 -0
- package/dist/esm/wire.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,18 @@ Versions follow semantic versioning.
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.12.0] - 2026-09-28
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- **An empty ledger verified as OK.** `attenu-guard verify` on a 0-byte (or blank-lines-only) `.jsonl` printed `OK` and exited 0. It now prints `EMPTY — no events to verify` and exits 2, the same line and exit code as the Python CLI. A bundle with zero entries was already refused by `verifyBundle` as `missing_root`, and is now pinned by a test
|
|
13
|
+
|
|
14
|
+
## [0.11.0] - 2026-09-20
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- **`export_bundle(strict=True)` raised `EvidenceLeakError` on any run that refused a delegation.** `detail` is written by the library itself on a refusal (`max_depth`, `max_fanout`, `chain_revoked`, `agent_banned`, `integrity`, `ttl_expired`, and the aggregate-ceiling case) and carries only structural values — an agent or parent id, a numeric limit, a ceiling key — but it was missing from `LEDGER_FIELDS`. That list gates custody mode, so the export an enterprise uses reported a field this library wrote as though it were customer data that must not leave the premises, and refused to produce a bundle. Broken for a whole class of ordinary runs. Found when the verify-side check above failed on our own omnigent example, which is the one place CI drives a depth refusal end to end
|
|
18
|
+
- **`verify_bundle` reported success on ledger entries it only partly read.** `LEDGER_FIELDS` existed but was enforced only on the EXPORT path (`redaction_report`, via `export_bundle(strict=True)`) as a custody check — never on verify. So the verifier read entries by projection: it picked the fields it knows and never looked at the rest. A producer could add `deny_scopes` and `critical` to a `spawn` entry, rehash the chain from genesis exactly as an honest producer does, and `verify_bundle` returned `ok: True` with zero failures while those fields stayed invisible in `delegation_graph`. Demonstrated with a control that re-chains an unmodified bundle and still verifies, so the result isolates the read and is not just the hash covering the field. This is the same defect as the token-side one above, on the offline-verifiable audit trail — the artefact whose whole purpose is that a third party can check it without us. Envelopes (`ENVELOPE_MEMBERS`) already read whole, and an anchor is covered by its signature. **The boundary is stated rather than implied, because a first version of this claimed more than it closed:** in scope are an entry's top-level keys, the `authority` / `granted` wire objects inside it (`Authority.from_wire` now refuses a member outside `scopes`/`constraints`/`ttl` — the token path built that dict itself and was safe only by accident, the bundle path hands over the raw untrusted object), and each constraint within those. Deliberately OUT of scope: `context`, which is free-form by contract and redacted for transport, and the bundle's own top-level members, which no signature covers. New check `checks["ledger_fields"]` and reason `unknown_ledger_fields`, naming every offending field; reported as a failure rather than raised, because an unknown field is a property of the bundle and not an error in the call. Identical rule and identical reason string in the TypeScript port
|
|
19
|
+
- **A Delegation Token carrying authorization data the verifier does not understand verified clean, with that data silently discarded.** Three levels, one defect. (1) `load()` read `authorization_details[0]` and never looked at the rest. (2) Worse, and missed by the first fix: inside a **single** `agent_delegation` entry the loader cherry-picked `scopes` and `constraints` and discarded every other member — so `actions`, `locations`, `datatypes`, `identifier` and `privileges`, the RFC 9396 §2 common members of *any* authorization detail object, were dropped in silence, as was `critical`, whose entire meaning is "do not ignore me". The draft's token format cites RFC 9396 by name, so an issuer restricting this way was doing the sanctioned thing. (3) A constraint object carrying two typed values kept one and dropped the other: `{"key":"max_rows","max":100,"min":9999}` became `{"key":"max_rows","max":100}`, byte-identical to one that never carried a floor. Fail-open in exactly one direction, and it is the dangerous one: ignored data that RESTRICTS authority is lost, while data that GRANTS extra authority is harmless because ignoring it leaves the chain more restrictive. `load()` now refuses, as `malformed`, a token carrying more than one authorization detail, a detail carrying members beyond `type`/`scopes`/`constraints`, or a constraint carrying a member this build does not read; every message names what could not be evaluated. An unrecognised constraint **type** is deliberately still accepted into the fail-closed `UnknownCeiling` path the draft requires, rather than becoming a parse error. RFC 8785 canonicalization is not the protection — re-serializing through the canonicaliser produces a token the old verifier accepted — and a test asserts the refusal reason is never `non_canonical` so it cannot quietly stand in for the real rule. **This is a wire-behaviour change: a token that verified before is now refused.** No fixture under `test/fixtures/vectors/` carries more than one entry or an unread member. Lands together with the identical rules in the Python port, and both were checked to accept and refuse the same eight cases byte-for-byte through `load()`
|
|
20
|
+
|
|
9
21
|
## [0.10.0] - 2026-09-08
|
|
10
22
|
|
|
11
23
|
Parity with attenu-guard (Python) 0.16.0.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authority.d.ts","sourceRoot":"","sources":["../../src/authority.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAA6C,KAAK,KA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QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IAEtC,gEAAgE;IAChE,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;gBAEhB,IAAI,GAAE,aAAkB;IAYpC,OAAO,CAAC,KAAK;IAMb,kDAAkD;IAClD,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAMzC,4EAA4E;IAC5E,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO;IAM5D,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IASvC;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS;IAsCjC;;;;;;;;;;;;;;;OAeG;IACH,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO;IAkBzC;;;;;;;;OAQG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,GAAE,OAAO,GAAG,IAAW,GAAG,QAAQ;IA0B5D,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS;IAM/B,MAAM,IAAI,aAAa;IAQvB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,GAAG,SAAS;IA+BvC,0CAA0C;IAC1C,QAAQ,IAAI,MAAM;IAMlB,QAAQ,IAAI,MAAM;CAGnB"}
|
package/dist/cjs/authority.js
CHANGED
|
@@ -44,6 +44,76 @@ class AuthorityError extends Error {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
exports.AuthorityError = AuthorityError;
|
|
47
|
+
/**
|
|
48
|
+
* `ceilingFromWire`, but refusing a constraint we would only partly read.
|
|
49
|
+
*
|
|
50
|
+
* The test is a MEMBER difference, not value equality. Parse the constraint,
|
|
51
|
+
* re-emit it, and refuse if the input carried a member the re-emission does not
|
|
52
|
+
* -- that member is one this build did not read. That was live and silent:
|
|
53
|
+
*
|
|
54
|
+
* {"key":"max_rows","max":100,"min":9999} -> {"key":"max_rows","max":100}
|
|
55
|
+
*
|
|
56
|
+
* byte-identical to a constraint that never carried a floor. `min` is a
|
|
57
|
+
* first-class type in the draft's constraint vocabulary ("the value MUST NOT be
|
|
58
|
+
* less than it"), so this dropped a signed, spec-defined, *restricting* term.
|
|
59
|
+
* The draft allows one typed value per object, which makes two malformed -- it
|
|
60
|
+
* must be refused, never silently resolved to whichever one this build happens
|
|
61
|
+
* to read first.
|
|
62
|
+
*
|
|
63
|
+
* Comparing whole VALUES instead was tried and reverted before release: it
|
|
64
|
+
* could not tell "we ignored a member" from "we normalised a value", and
|
|
65
|
+
* several built-ins legitimately normalise (`Allow` emits its `one_of` sorted
|
|
66
|
+
* and holds it as a set; `toWire` omits `field` when it equals `key`). RFC 8785
|
|
67
|
+
* canonicalises object member ORDER and never reorders array elements, and the
|
|
68
|
+
* draft puts no ordering or uniqueness requirement on `one_of` -- so
|
|
69
|
+
* `["us-west", "us-east"]` is a conformant constraint from a third-party
|
|
70
|
+
* issuer, and value equality called it malformed. On a release whose whole
|
|
71
|
+
* subject is reading tokens correctly, refusing correct tokens is the worse
|
|
72
|
+
* failure.
|
|
73
|
+
*
|
|
74
|
+
* An unrecognised constraint TYPE is deliberately not caught here:
|
|
75
|
+
* `UnknownCeiling` preserves its whole object, so nothing looks dropped, and it
|
|
76
|
+
* still routes to the fail-closed path the draft requires. Rejecting those here
|
|
77
|
+
* would turn a deny into a parse error and lose that distinction.
|
|
78
|
+
*
|
|
79
|
+
* Kept in step with the Python port (`authority._ceiling_from_wire_whole`).
|
|
80
|
+
*/
|
|
81
|
+
function ceilingFromWireWhole(c) {
|
|
82
|
+
const ceiling = (0, ceilings_js_1.ceilingFromWire)(c);
|
|
83
|
+
const input = (0, canonical_js_1.toPlain)(c);
|
|
84
|
+
if (input !== undefined && input !== null && typeof input === "object") {
|
|
85
|
+
const emitted = (0, canonical_js_1.toPlain)(ceiling.toWire()) ?? {};
|
|
86
|
+
// `key` is the one member whose VALUE is load-bearing: subsumption pairs
|
|
87
|
+
// ceilings by it, so a rewritten key is a different dimension, not a
|
|
88
|
+
// cosmetic difference. `CallLimit` rewrites it ("max_calls" ->
|
|
89
|
+
// "max_calls[fs.write]" when `applies_to` is present), which the member test
|
|
90
|
+
// cannot see because the member set is unchanged. Checked on its own rather
|
|
91
|
+
// than by returning to whole-value equality, which broke conformant tokens a
|
|
92
|
+
// revision ago.
|
|
93
|
+
if (emitted["key"] !== input["key"]) {
|
|
94
|
+
throw new AuthorityError(`constraint ${JSON.stringify(input)} names dimension ${JSON.stringify(input["key"])} ` +
|
|
95
|
+
`but this build reads it as ${JSON.stringify(emitted["key"])}; refusing rather ` +
|
|
96
|
+
"than silently changing which dimension is bounded", "malformed_constraint");
|
|
97
|
+
}
|
|
98
|
+
const dropped = Object.keys(input)
|
|
99
|
+
.filter((k) => !(k in emitted))
|
|
100
|
+
// `field` is read and then not re-emitted when it equals `key`, because at
|
|
101
|
+
// that point it is redundant. Absent from the emission does not mean
|
|
102
|
+
// unread, so exempt it only on EVIDENCE that this ceiling parsed it: the
|
|
103
|
+
// attribute the constructor actually populated. `ctxFieldOf` is not that
|
|
104
|
+
// evidence -- it falls back to a hardcoded `ctxField` and then to `key`,
|
|
105
|
+
// so it returns the input's value by coincidence for the metered built-ins
|
|
106
|
+
// (which never read `field` at all) and unconditionally for a custom
|
|
107
|
+
// ceiling deriving `ctxField` from its own input.
|
|
108
|
+
.filter((k) => !(k === "field" && ceiling.field === input["field"]))
|
|
109
|
+
.sort();
|
|
110
|
+
if (dropped.length > 0) {
|
|
111
|
+
throw new AuthorityError(`constraint ${JSON.stringify(input)} carries members this build does not ` +
|
|
112
|
+
`evaluate and will not ignore: ${dropped.join(", ")}`, "malformed_constraint");
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return ceiling;
|
|
116
|
+
}
|
|
47
117
|
const SCOPE_RE = /^[a-z][a-z0-9_-]*(?:\.[a-z][a-z0-9_-]*)*\.(?:[a-z][a-z0-9_-]*|\*)$/;
|
|
48
118
|
function validateScope(scope) {
|
|
49
119
|
if (typeof scope !== "string" || !SCOPE_RE.test(scope)) {
|
|
@@ -227,12 +297,28 @@ class Authority {
|
|
|
227
297
|
}
|
|
228
298
|
static fromWire(wire) {
|
|
229
299
|
const d = (0, canonical_js_1.toPlain)(wire) ?? {};
|
|
300
|
+
// Read the authority object WHOLE, for the same reason the constraint inside
|
|
301
|
+
// it is read whole. The token path is safe only by accident --
|
|
302
|
+
// `authorityFromPayload` builds this object itself after checking the
|
|
303
|
+
// detail's members -- but the BUNDLE path hands us the raw untrusted object
|
|
304
|
+
// straight out of a ledger entry (`evidence`, the `authority` and `granted`
|
|
305
|
+
// members). Without this, `verifyBundle` reported success on an authority it
|
|
306
|
+
// had read by projection: a `granted` carrying `deny_scopes` verified clean
|
|
307
|
+
// with `checks.ledger_fields` true, because that check only covers an
|
|
308
|
+
// entry's TOP-LEVEL keys. Kept in step with the Python port.
|
|
309
|
+
const unknownAuthorityMembers = Object.keys(d)
|
|
310
|
+
.filter((k) => k !== "scopes" && k !== "constraints" && k !== "ttl")
|
|
311
|
+
.sort();
|
|
312
|
+
if (unknownAuthorityMembers.length > 0) {
|
|
313
|
+
throw new AuthorityError(`authority ${JSON.stringify(d)} carries members this build does not evaluate ` +
|
|
314
|
+
`and will not ignore: ${unknownAuthorityMembers.join(", ")}`, "malformed_authority");
|
|
315
|
+
}
|
|
230
316
|
const scopes = d["scopes"] ?? [];
|
|
231
317
|
const constraints = d["constraints"] ?? [];
|
|
232
318
|
const ttl = d["ttl"];
|
|
233
319
|
return new Authority({
|
|
234
320
|
scopes,
|
|
235
|
-
ceilings: constraints.map((c) => (
|
|
321
|
+
ceilings: constraints.map((c) => ceilingFromWireWhole(c)),
|
|
236
322
|
ttl: typeof ttl === "number" ? ttl : null,
|
|
237
323
|
});
|
|
238
324
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authority.js","sourceRoot":"","sources":["../../src/authority.ts"],"names":[],"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C,QAAQ;QACN,MAAM,MAAM,GAAG,IAAA,4BAAa,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrD,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,sBAAe,EAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,gCAAiB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3F,OAAO,WAAW,MAAM,eAAe,EAAE,SAAS,IAAI,CAAC,GAAG,EAAE,CAAC;IAC/D,CAAC;IAED,QAAQ;QACN,OAAO,aAAa,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;IACzC,CAAC;CACF;AArOD,8BAqOC"}
|
package/dist/cjs/cli.d.ts
CHANGED
|
@@ -12,8 +12,11 @@
|
|
|
12
12
|
* keys for a bundle carrying observer envelopes; without it every envelope fails
|
|
13
13
|
* `envelope_unknown_witness`, and the output says which flag to pass.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* A ledger with zero events is reported EMPTY, not OK.
|
|
16
|
+
*
|
|
17
|
+
* Exit codes: 0 = ok, 2 = a check failed or there was nothing to check, 1 = usage.
|
|
18
|
+
* The output lines match the Python CLI's, so either implementation can stand in
|
|
19
|
+
* for the other in a script.
|
|
17
20
|
*/
|
|
18
21
|
export declare function main(argv?: string[]): number;
|
|
19
22
|
//# sourceMappingURL=cli.d.ts.map
|
package/dist/cjs/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAqHH,wBAAgB,IAAI,CAAC,IAAI,GAAE,MAAM,EAA0B,GAAG,MAAM,CAanE"}
|
package/dist/cjs/cli.js
CHANGED
|
@@ -13,8 +13,11 @@
|
|
|
13
13
|
* keys for a bundle carrying observer envelopes; without it every envelope fails
|
|
14
14
|
* `envelope_unknown_witness`, and the output says which flag to pass.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* A ledger with zero events is reported EMPTY, not OK.
|
|
17
|
+
*
|
|
18
|
+
* Exit codes: 0 = ok, 2 = a check failed or there was nothing to check, 1 = usage.
|
|
19
|
+
* The output lines match the Python CLI's, so either implementation can stand in
|
|
20
|
+
* for the other in a script.
|
|
18
21
|
*/
|
|
19
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
23
|
exports.main = main;
|
|
@@ -22,6 +25,8 @@ const node_fs_1 = require("node:fs");
|
|
|
22
25
|
const audit_js_1 = require("./audit.js");
|
|
23
26
|
const evidence_js_1 = require("./evidence.js");
|
|
24
27
|
const wire_js_1 = require("./wire.js");
|
|
28
|
+
/** The Python CLI prints the same line for the same file. */
|
|
29
|
+
const EMPTY = "EMPTY — no events to verify";
|
|
25
30
|
const USAGE = `attenu-guard — command-line tool.
|
|
26
31
|
|
|
27
32
|
attenu-guard verify <log.jsonl | bundle.json> [--hs256-key HEX | --pubkey HEX] [--kid KID]
|
|
@@ -116,6 +121,12 @@ function verify(args) {
|
|
|
116
121
|
return rep.ok ? 0 : 2;
|
|
117
122
|
}
|
|
118
123
|
const entries = audit_js_1.AuditLog.parseLines(text);
|
|
124
|
+
if (entries.length === 0) {
|
|
125
|
+
// A ledger with no entries has nothing to verify. Reporting it OK would be a fail-open: a
|
|
126
|
+
// truncated or never-written file would pass the same check as a clean chain.
|
|
127
|
+
process.stdout.write(`${EMPTY}\n`);
|
|
128
|
+
return 2;
|
|
129
|
+
}
|
|
119
130
|
const [ok, reason] = audit_js_1.AuditLog.verify(entries);
|
|
120
131
|
process.stdout.write(ok ? "OK\n" : `TAMPERED — ${reason}\n`);
|
|
121
132
|
return ok ? 0 : 2;
|
package/dist/cjs/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AAqHH,oBAaC;AAhID,qCAAuC;AAEvC,yCAAsC;AACtC,+CAAwF;AACxF,uCAA0E;AAE1E,6DAA6D;AAC7D,MAAM,KAAK,GAAG,6BAA6B,CAAC;AAE5C,MAAM,KAAK,GAAG;;;;;;;;CAQb,CAAC;AAEF;;;;;;;;GAQG;AACH,SAAS,eAAe,CAAC,IAAY;IACnC,IAAI,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,IAAA,sBAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7D,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,cAAc,IAAI,MAAM,EAAE,CAAC;QACxG,MAAM,GAAI,MAAkC,CAAC,cAAc,CAAC,CAAC;IAC/D,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,wDAAwD,OAAO,MAAM,EAAE,CAAC,CAAC;IAClG,CAAC;IACD,OAAO,MAA+B,CAAC;AACzC,CAAC;AAED,iFAAiF;AACjF,SAAS,EAAE,CAAC,KAAc;IACxB,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;AAClC,CAAC;AAED,SAAS,MAAM,CAAC,IAAc;IAC5B,IAAI,IAAI,GAAkB,IAAI,CAAC;IAC/B,IAAI,MAAM,GAAkB,IAAI,CAAC;IACjC,IAA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AC;QAC5B,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAC5B,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,QAAQ,CAAC,EAAE,CAAC;QACvF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5B,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,GAAG,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;IAC7D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5B,OAAO,CAAC,CAAC;AACX,CAAC"}
|
package/dist/cjs/evidence.d.ts
CHANGED
|
@@ -202,6 +202,12 @@ export interface VerifyChecks {
|
|
|
202
202
|
containment: boolean;
|
|
203
203
|
anchor: "not checked" | "verified" | "FAILED";
|
|
204
204
|
version: boolean;
|
|
205
|
+
/**
|
|
206
|
+
* Every entry's top-level fields are within `LEDGER_FIELDS`. False means the bundle carries a
|
|
207
|
+
* field this verifier does not evaluate, so reporting success would be reporting it on an entry
|
|
208
|
+
* that was only partly read.
|
|
209
|
+
*/
|
|
210
|
+
ledger_fields: boolean;
|
|
205
211
|
chain_id: boolean;
|
|
206
212
|
root: boolean;
|
|
207
213
|
expected_anchor: "not checked" | "verified" | "FAILED";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evidence.d.ts","sourceRoot":"","sources":["../../src/evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAQL,KAAK,KAAK,EACV,KAAK,IAAI,EACV,MAAM,gBAAgB,CAAC;AA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,EAAE,IAAI,CAAC;IACf,iBAAiB,EAAE,gBAAgB,CAAC;IACpC;;;OAGG;IACH,SAAS,EAAE,eAAe,CAAC;IAC3B,uDAAuD;IACvD,gBAAgB,EAAE,iBAAiB,GAAG,eAAe,CAAC;CACvD;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,mBAAmB;IAClC,0FAA0F;IAC1F,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;IACvD,0FAA0F;IAC1F,YAAY,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAChD;;;;;OAKG;IACH,WAAW,CAAC,EAAE,SAAS,UAAU,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC;IAC7E;;;OAGG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC;CAC5D;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,EACvB,MAAM,GAAE,MAAM,GAAG,IAAW,EAC5B,OAAO,GAAE,mBAAwB,GAChC,YAAY,CAwSd;AAED,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD"}
|
package/dist/cjs/evidence.js
CHANGED
|
@@ -87,6 +87,15 @@ exports.LEDGER_FIELDS = new Set([
|
|
|
87
87
|
"strikes",
|
|
88
88
|
"mode",
|
|
89
89
|
"disposition",
|
|
90
|
+
// `detail` is library-written on a refusal (max_depth, max_fanout, chain_revoked, agent_banned,
|
|
91
|
+
// integrity, ttl_expired, aggregate ceiling) and carries only structural values -- an agent or
|
|
92
|
+
// parent id, a numeric limit, a ceiling key. Same class as `node`/`parent`/`agent`; never free
|
|
93
|
+
// text like `task`, never caller-supplied like `context`.
|
|
94
|
+
//
|
|
95
|
+
// Its absence was not cosmetic: LEDGER_FIELDS gates `exportBundle({strict: true})`, so custody
|
|
96
|
+
// mode threw on ANY run that refused a delegation, reporting a field this library wrote as
|
|
97
|
+
// though it were customer data. Kept in step with the Python port.
|
|
98
|
+
"detail",
|
|
90
99
|
// `policy` marks an allow the chain never authorized (an `allowUnlisted` passthrough) — see
|
|
91
100
|
// reasons.Policy and the containment check below. Not a v2-only field.
|
|
92
101
|
"policy",
|
|
@@ -1652,6 +1661,7 @@ function verifyBundle(bundle, signer = null, options = {}) {
|
|
|
1652
1661
|
containment: false,
|
|
1653
1662
|
anchor: "not checked",
|
|
1654
1663
|
version: false,
|
|
1664
|
+
ledger_fields: false,
|
|
1655
1665
|
chain_id: false,
|
|
1656
1666
|
root: false,
|
|
1657
1667
|
expected_anchor: "not checked",
|
|
@@ -1694,6 +1704,33 @@ function verifyBundle(bundle, signer = null, options = {}) {
|
|
|
1694
1704
|
log.add("mixed_entry_versions", `mixed_entry_versions: entries declare v in [${mixed.map((v) => pyRepr(v)).join(", ")}], bundle v=${pyRepr(bundleV)}`, { seq: orNull(mixedEntries[0]["seq"]), node: orNull(mixedEntries[0]["node"]) });
|
|
1695
1705
|
}
|
|
1696
1706
|
checks.version = versionOk;
|
|
1707
|
+
// (0b2) every entry must be read WHOLE. `LEDGER_FIELDS` was enforced only on the EXPORT path
|
|
1708
|
+
// (`redactionReport`, via `exportBundle({strict: true})`), never on verify, so the verifier read
|
|
1709
|
+
// entries by projection: it picked the fields it knows and never looked at the rest. A producer
|
|
1710
|
+
// could add `deny_scopes` and `critical` to a `spawn` entry, rehash the chain from genesis as any
|
|
1711
|
+
// honest producer does, and `verifyBundle` returned ok=true with zero failures while those fields
|
|
1712
|
+
// stayed invisible in `delegationGraph`.
|
|
1713
|
+
//
|
|
1714
|
+
// That is the same defect as the token-side one this release fixes -- reporting success on input
|
|
1715
|
+
// we did not fully read -- but on the offline-verifiable audit trail, which is the thing the
|
|
1716
|
+
// bundle exists to be. Envelopes and anchors already read whole; this was the one structure left.
|
|
1717
|
+
//
|
|
1718
|
+
// Reported as a failure rather than thrown: `verifyBundle` returns a report, and an unknown field
|
|
1719
|
+
// is a property of the bundle, not an error in the call.
|
|
1720
|
+
//
|
|
1721
|
+
// Kept in step with the Python port (`evidence._verify_bundle`, same check, same reason string).
|
|
1722
|
+
let unknownOk = true;
|
|
1723
|
+
for (const e of entries) {
|
|
1724
|
+
const extra = Object.keys(e)
|
|
1725
|
+
.filter((f) => !exports.LEDGER_FIELDS.has(f))
|
|
1726
|
+
.sort();
|
|
1727
|
+
if (extra.length > 0) {
|
|
1728
|
+
unknownOk = false;
|
|
1729
|
+
log.add("unknown_ledger_fields", `unknown_ledger_fields: entry carries fields this verifier does not evaluate and will ` +
|
|
1730
|
+
`not ignore: ${extra.join(", ")}`, { seq: orNull(e["seq"]), node: orNull(e["node"]) });
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
checks.ledger_fields = unknownOk;
|
|
1697
1734
|
// (0c) independently retained expected anchor/head: verified against the BUNDLE's actual
|
|
1698
1735
|
// computed head, never against its own (possibly forged) enclosed anchor.
|
|
1699
1736
|
const { expectedAnchor = null, expectedHead = null } = options;
|
|
@@ -1844,6 +1881,7 @@ function verifyBundle(bundle, signer = null, options = {}) {
|
|
|
1844
1881
|
checks.monotonicity &&
|
|
1845
1882
|
checks.containment &&
|
|
1846
1883
|
checks.version &&
|
|
1884
|
+
checks.ledger_fields &&
|
|
1847
1885
|
checks.chain_id &&
|
|
1848
1886
|
checks.root &&
|
|
1849
1887
|
log.length === 0;
|