attenu-guard 0.1.0 → 0.2.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 +34 -0
- package/README.md +12 -4
- package/dist/cjs/audit.d.ts +1 -0
- package/dist/cjs/audit.d.ts.map +1 -1
- package/dist/cjs/audit.js +9 -5
- package/dist/cjs/audit.js.map +1 -1
- package/dist/cjs/canonical.d.ts +21 -69
- package/dist/cjs/canonical.d.ts.map +1 -1
- package/dist/cjs/canonical.js +198 -171
- package/dist/cjs/canonical.js.map +1 -1
- package/dist/cjs/evidence.d.ts +1 -0
- package/dist/cjs/evidence.d.ts.map +1 -1
- package/dist/cjs/evidence.js +8 -3
- package/dist/cjs/evidence.js.map +1 -1
- package/dist/cjs/index.d.ts +4 -4
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +14 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/wire.d.ts +136 -1
- package/dist/cjs/wire.d.ts.map +1 -1
- package/dist/cjs/wire.js +405 -2
- package/dist/cjs/wire.js.map +1 -1
- package/dist/esm/audit.d.ts +1 -0
- package/dist/esm/audit.d.ts.map +1 -1
- package/dist/esm/audit.js +10 -6
- package/dist/esm/audit.js.map +1 -1
- package/dist/esm/canonical.d.ts +21 -69
- package/dist/esm/canonical.d.ts.map +1 -1
- package/dist/esm/canonical.js +192 -168
- package/dist/esm/canonical.js.map +1 -1
- package/dist/esm/evidence.d.ts +1 -0
- package/dist/esm/evidence.d.ts.map +1 -1
- package/dist/esm/evidence.js +8 -3
- package/dist/esm/evidence.js.map +1 -1
- package/dist/esm/index.d.ts +4 -4
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/wire.d.ts +136 -1
- package/dist/esm/wire.d.ts.map +1 -1
- package/dist/esm/wire.js +400 -2
- package/dist/esm/wire.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/wire.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* wire.ts — the signing
|
|
2
|
+
* wire.ts — the Delegation Token: signing backends + offline chain verification.
|
|
3
3
|
*
|
|
4
4
|
* Anchors and delegation tokens are signed over canonical JSON bytes. Two
|
|
5
5
|
* backends ship, matching the Python library's `attenu_guard.wire`:
|
|
@@ -8,11 +8,29 @@
|
|
|
8
8
|
* `Ed25519Signer` the production signer the Internet-Draft requires, with
|
|
9
9
|
* `Ed25519Verifier` for anyone holding only the public half.
|
|
10
10
|
*
|
|
11
|
+
* The second half of the module is `load()`: the Offline Verification Algorithm
|
|
12
|
+
* of draft-asor-wimse-agent-delegation-chain-00, ported from `wire.py`'s
|
|
13
|
+
* `load()`. A Delegation Token is a compact, JWT-shaped, JWS-signed object
|
|
14
|
+
* carrying one hop's `Authority` plus enough chain-linkage state (`del_depth`,
|
|
15
|
+
* `del_max_depth`, `par_hash`) that an Enforcement Point can verify an entire
|
|
16
|
+
* Delegation Chain with no call to an authorization server. The 17 interop
|
|
17
|
+
* vectors under `test/fixtures/vectors/` are the check on that port: they are
|
|
18
|
+
* generated by the Python reference implementation and each declares the exact
|
|
19
|
+
* reason it must be accepted or rejected for.
|
|
20
|
+
*
|
|
21
|
+
* This module MINTS nothing. Serialization (`serialize`/`serialize_chain` in
|
|
22
|
+
* Python) is the issuing side and lives with whoever holds the signing key;
|
|
23
|
+
* what a TypeScript enforcement point needs is the verifying side.
|
|
24
|
+
*
|
|
11
25
|
* Everything here is built on Node's own `node:crypto`, so the package keeps
|
|
12
26
|
* zero runtime dependencies. Ed25519 keys are wrapped in the fixed DER prefixes
|
|
13
27
|
* below rather than pulled from a library.
|
|
14
28
|
*/
|
|
15
|
-
import { createHmac, createPrivateKey, createPublicKey, generateKeyPairSync, sign as cryptoSign, timingSafeEqual, verify as cryptoVerify, } from "node:crypto";
|
|
29
|
+
import { createHash, createHmac, createPrivateKey, createPublicKey, generateKeyPairSync, sign as cryptoSign, timingSafeEqual, verify as cryptoVerify, } from "node:crypto";
|
|
30
|
+
import { TextDecoder } from "node:util";
|
|
31
|
+
import { Authority } from "./authority.js";
|
|
32
|
+
import { CanonicalizationError, DuplicateMemberError, NonFiniteNumberError, RawNumber, canonicalJson, parseJson, toPlain, } from "./canonical.js";
|
|
33
|
+
import { ReasonCode } from "./reasons.js";
|
|
16
34
|
/**
|
|
17
35
|
* stdlib HMAC-SHA256 signer — the default for tests, examples and local dev,
|
|
18
36
|
* because it needs no key management at all.
|
|
@@ -156,4 +174,384 @@ export class Ed25519Verifier {
|
|
|
156
174
|
return rawPublicBytes(this.publicKey);
|
|
157
175
|
}
|
|
158
176
|
}
|
|
177
|
+
// ===========================================================================
|
|
178
|
+
// base64url (RFC 7515 §2: standard base64, `+`/`/` -> `-`/`_`, no `=` padding)
|
|
179
|
+
// ===========================================================================
|
|
180
|
+
/** Encode `data` as unpadded base64url — the encoding every token part uses. */
|
|
181
|
+
export function b64urlEncode(data) {
|
|
182
|
+
return data.toString("base64url");
|
|
183
|
+
}
|
|
184
|
+
const B64URL = /^[A-Za-z0-9_-]*$/;
|
|
185
|
+
/**
|
|
186
|
+
* Decode unpadded base64url. Node re-pads internally, so a token part never has
|
|
187
|
+
* to carry `=`.
|
|
188
|
+
*
|
|
189
|
+
* The alphabet and length are checked first, and a bad string throws. Node's own
|
|
190
|
+
* decoder is lenient — it silently drops characters outside the alphabet — which
|
|
191
|
+
* would turn a garbage `par_hash` into a *hash* mismatch instead of the
|
|
192
|
+
* malformed input it actually is. Python's `b64url_decode` raises there and
|
|
193
|
+
* `load()` reports `malformed`; this check is what keeps the two reporting the
|
|
194
|
+
* same reason for the same bytes. A length of 1 mod 4 encodes no whole byte and
|
|
195
|
+
* is rejected for the same reason.
|
|
196
|
+
*/
|
|
197
|
+
export function b64urlDecode(s) {
|
|
198
|
+
if (!B64URL.test(s) || s.length % 4 === 1) {
|
|
199
|
+
throw new Error(`not valid base64url: ${JSON.stringify(s)}`);
|
|
200
|
+
}
|
|
201
|
+
return Buffer.from(s, "base64url");
|
|
202
|
+
}
|
|
203
|
+
// ===========================================================================
|
|
204
|
+
// Errors / reason codes
|
|
205
|
+
// ===========================================================================
|
|
206
|
+
/**
|
|
207
|
+
* Wire-verification-specific reason codes, string constants (same pattern as
|
|
208
|
+
* `ReasonCode` — see reasons.ts). `EXPIRED` is not reinvented: it aliases
|
|
209
|
+
* `ReasonCode.EXPIRED` verbatim (identical string, identical meaning: a
|
|
210
|
+
* time-bound invariant failed), covering both "now is past exp" and "exp is not
|
|
211
|
+
* monotonic along the chain" — the draft treats both as the same class of check
|
|
212
|
+
* (verification step 5).
|
|
213
|
+
*/
|
|
214
|
+
export const WireReasonCode = {
|
|
215
|
+
SIGNATURE_INVALID: "signature_invalid",
|
|
216
|
+
PAR_HASH_MISMATCH: "par_hash_mismatch",
|
|
217
|
+
DEPTH_INVALID: "depth_invalid",
|
|
218
|
+
NOT_NARROWER: "not_narrower",
|
|
219
|
+
MALFORMED: "malformed",
|
|
220
|
+
NON_FINITE: "non_finite",
|
|
221
|
+
DUPLICATE_MEMBER: "duplicate_member",
|
|
222
|
+
CANONICALIZATION_REQUIRED: "canonicalization_required",
|
|
223
|
+
NON_CANONICAL: "non_canonical",
|
|
224
|
+
EXPIRED: ReasonCode.EXPIRED, // "expired" — reuse, don't reinvent
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* Thrown by `load()` on the FIRST verification failure (the draft: "denying on
|
|
228
|
+
* the first failure") — offline chain verification is fail-fast and fail-closed,
|
|
229
|
+
* not an aggregation of every problem found.
|
|
230
|
+
*
|
|
231
|
+
* The constructor takes `(reason, message)`, mirroring Python's `WireError` so
|
|
232
|
+
* the two `load()`s read the same line for line. That is the opposite order to
|
|
233
|
+
* `AuthorityError(message, reason)`; here the reason code is the contract and
|
|
234
|
+
* the message is the human gloss.
|
|
235
|
+
*/
|
|
236
|
+
export class WireError extends Error {
|
|
237
|
+
reason;
|
|
238
|
+
constructor(reason, message = "") {
|
|
239
|
+
super(message);
|
|
240
|
+
this.name = "WireError";
|
|
241
|
+
this.reason = reason;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function isJsonObject(value) {
|
|
245
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
246
|
+
}
|
|
247
|
+
function parseToken(token) {
|
|
248
|
+
const parts = token.split(".");
|
|
249
|
+
if (parts.length !== 3) {
|
|
250
|
+
throw new WireError(WireReasonCode.MALFORMED, `expected 3 dot-separated parts, got ${parts.length}`);
|
|
251
|
+
}
|
|
252
|
+
const [headerB64, payloadB64, sigB64] = parts;
|
|
253
|
+
let headerBytes;
|
|
254
|
+
let payloadBytes;
|
|
255
|
+
let sig;
|
|
256
|
+
try {
|
|
257
|
+
headerBytes = b64urlDecode(headerB64);
|
|
258
|
+
payloadBytes = b64urlDecode(payloadB64);
|
|
259
|
+
sig = b64urlDecode(sigB64);
|
|
260
|
+
}
|
|
261
|
+
catch (e) {
|
|
262
|
+
throw new WireError(WireReasonCode.MALFORMED, `could not decode token: ${String(e)}`);
|
|
263
|
+
}
|
|
264
|
+
let headerRaw;
|
|
265
|
+
let payloadRaw;
|
|
266
|
+
try {
|
|
267
|
+
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
268
|
+
headerRaw = parseJson(decoder.decode(headerBytes));
|
|
269
|
+
payloadRaw = parseJson(decoder.decode(payloadBytes));
|
|
270
|
+
}
|
|
271
|
+
catch (e) {
|
|
272
|
+
if (e instanceof DuplicateMemberError) {
|
|
273
|
+
throw new WireError(WireReasonCode.DUPLICATE_MEMBER, e.message);
|
|
274
|
+
}
|
|
275
|
+
if (e instanceof NonFiniteNumberError) {
|
|
276
|
+
throw new WireError(WireReasonCode.NON_FINITE, e.message);
|
|
277
|
+
}
|
|
278
|
+
if (e instanceof CanonicalizationError) {
|
|
279
|
+
throw new WireError(WireReasonCode.NON_CANONICAL, e.message);
|
|
280
|
+
}
|
|
281
|
+
throw new WireError(WireReasonCode.MALFORMED, `could not parse token JSON: ${String(e)}`);
|
|
282
|
+
}
|
|
283
|
+
const header = toPlain(headerRaw);
|
|
284
|
+
const payload = toPlain(payloadRaw);
|
|
285
|
+
if (!isJsonObject(header) || !isJsonObject(payload)) {
|
|
286
|
+
throw new WireError(WireReasonCode.MALFORMED, "header/payload must be JSON objects");
|
|
287
|
+
}
|
|
288
|
+
if (header["c14n"] !== "JCS") {
|
|
289
|
+
throw new WireError(WireReasonCode.CANONICALIZATION_REQUIRED, "token header must declare c14n='JCS'");
|
|
290
|
+
}
|
|
291
|
+
let canonicalHeader;
|
|
292
|
+
let canonicalPayload;
|
|
293
|
+
try {
|
|
294
|
+
canonicalHeader = canonicalJson(headerRaw);
|
|
295
|
+
canonicalPayload = canonicalJson(payloadRaw);
|
|
296
|
+
}
|
|
297
|
+
catch (e) {
|
|
298
|
+
if (e instanceof NonFiniteNumberError) {
|
|
299
|
+
throw new WireError(WireReasonCode.NON_FINITE, e.message);
|
|
300
|
+
}
|
|
301
|
+
if (e instanceof CanonicalizationError) {
|
|
302
|
+
throw new WireError(WireReasonCode.NON_CANONICAL, e.message);
|
|
303
|
+
}
|
|
304
|
+
throw e;
|
|
305
|
+
}
|
|
306
|
+
if (!headerBytes.equals(Buffer.from(canonicalHeader, "utf8")) ||
|
|
307
|
+
!payloadBytes.equals(Buffer.from(canonicalPayload, "utf8"))) {
|
|
308
|
+
throw new WireError(WireReasonCode.NON_CANONICAL, "token header and payload must be RFC 8785 JCS bytes");
|
|
309
|
+
}
|
|
310
|
+
return {
|
|
311
|
+
header,
|
|
312
|
+
payload,
|
|
313
|
+
payloadRaw: payloadRaw,
|
|
314
|
+
sig,
|
|
315
|
+
// ASCII, not utf8: the signing input is by definition the two base64url
|
|
316
|
+
// parts and a dot, so any byte outside ASCII could not have decoded.
|
|
317
|
+
signingInput: Buffer.from(`${headerB64}.${payloadB64}`, "ascii"),
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Rebuild the FULL `Authority` a token carries, including `ttl` (recovered as
|
|
322
|
+
* `exp - iat`), so `load()` can hand the very same `Authority.isNarrowerThan`
|
|
323
|
+
* the library uses for in-process attenuation. The draft's subsumption relation
|
|
324
|
+
* and the library relation must be the same relation, so this reconstitutes an
|
|
325
|
+
* `Authority` rather than comparing claim shapes by hand.
|
|
326
|
+
*
|
|
327
|
+
* `ttl` is deliberately absent from `authorization_details` on the wire: token
|
|
328
|
+
* lifetime is carried once, at the top level, in the standard `iat`/`exp`
|
|
329
|
+
* claims, where it cannot drift out of sync with itself.
|
|
330
|
+
*/
|
|
331
|
+
function authorityFromPayload(payload) {
|
|
332
|
+
const details = payload["authorization_details"];
|
|
333
|
+
if (!Array.isArray(details) || details.length === 0) {
|
|
334
|
+
throw new WireError(WireReasonCode.MALFORMED, "authorization_details missing or empty");
|
|
335
|
+
}
|
|
336
|
+
const d0 = details[0];
|
|
337
|
+
if (!isJsonObject(d0) || d0["type"] !== "agent_delegation") {
|
|
338
|
+
throw new WireError(WireReasonCode.MALFORMED, "authorization_details[0].type must be 'agent_delegation'");
|
|
339
|
+
}
|
|
340
|
+
const iat = payload["iat"];
|
|
341
|
+
const exp = payload["exp"];
|
|
342
|
+
if (typeof iat !== "number" || typeof exp !== "number") {
|
|
343
|
+
throw new WireError(WireReasonCode.MALFORMED, "iat/exp missing or not numeric");
|
|
344
|
+
}
|
|
345
|
+
const wire = {
|
|
346
|
+
scopes: d0["scopes"] ?? [],
|
|
347
|
+
constraints: d0["constraints"] ?? [],
|
|
348
|
+
ttl: exp - iat,
|
|
349
|
+
};
|
|
350
|
+
try {
|
|
351
|
+
return Authority.fromWire(wire);
|
|
352
|
+
}
|
|
353
|
+
catch (e) {
|
|
354
|
+
// A malformed constraint shape, and anything else the ceiling registry
|
|
355
|
+
// refuses to build: the token is unusable, so fail closed.
|
|
356
|
+
throw new WireError(WireReasonCode.MALFORMED, `invalid authorization_details: ${String(e)}`);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
// ===========================================================================
|
|
360
|
+
// load() — the Offline Verification Algorithm
|
|
361
|
+
// ===========================================================================
|
|
362
|
+
/**
|
|
363
|
+
* A chain that passed every check in `load()`. It carries only what an
|
|
364
|
+
* Enforcement Point needs afterwards: the LEAF authority — the only authority
|
|
365
|
+
* ever checked against an attempted action — plus enough raw material to log
|
|
366
|
+
* and debug with.
|
|
367
|
+
*/
|
|
368
|
+
export class VerifiedChain {
|
|
369
|
+
tokens;
|
|
370
|
+
payloads;
|
|
371
|
+
leafAuthority;
|
|
372
|
+
depth;
|
|
373
|
+
delMaxDepth;
|
|
374
|
+
constructor(tokens, payloads, leafAuthority, depth, delMaxDepth) {
|
|
375
|
+
this.tokens = tokens;
|
|
376
|
+
this.payloads = payloads;
|
|
377
|
+
this.leafAuthority = leafAuthority;
|
|
378
|
+
this.depth = depth;
|
|
379
|
+
this.delMaxDepth = delMaxDepth;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Authorize `scope` (with request context `ctx`) against the LEAF authority.
|
|
383
|
+
* Delegates entirely to `Authority.permits`; no policy logic is reimplemented
|
|
384
|
+
* here, so a decision taken from a verified chain and a decision taken
|
|
385
|
+
* in-process are the same decision.
|
|
386
|
+
*/
|
|
387
|
+
permits(scope, ctx = null) {
|
|
388
|
+
return this.leafAuthority.permits(scope, ctx);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Run the Offline Verification Algorithm over `tokens` (`[DT_0, ..., DT_n]`,
|
|
393
|
+
* root-first) and, on success, return a `VerifiedChain`. Denies on the FIRST
|
|
394
|
+
* failure by throwing a `WireError` whose `.reason` is one of the
|
|
395
|
+
* `WireReasonCode` constants.
|
|
396
|
+
*
|
|
397
|
+
* `signer` verifies every token in the chain — this implementation's
|
|
398
|
+
* simplifying trust model, matching Python's, is ONE signer/key material per
|
|
399
|
+
* whole chain. A production multi-issuer deployment would generalize `signer`
|
|
400
|
+
* into a `kid`-keyed resolver, which is a straightforward extension left out
|
|
401
|
+
* here.
|
|
402
|
+
*
|
|
403
|
+
* Steps performed, in the draft's own order:
|
|
404
|
+
* 1. JWS signature of every DT_i (+ the alg-confusion guard: the header's
|
|
405
|
+
* declared `alg` must equal `signer.alg` — never trust a token's own claim
|
|
406
|
+
* about which algorithm verifies it), plus the optional `rootKeyIds`
|
|
407
|
+
* restriction on DT_0.
|
|
408
|
+
* 2. The `par_hash` byte-commitment for every i > 0, compared in constant
|
|
409
|
+
* time; DT_0 MUST NOT carry one.
|
|
410
|
+
* 3. `del_depth`/`del_max_depth` bounds.
|
|
411
|
+
* 4. Subsumption: DT_i's authority `isNarrowerThan` DT_{i-1}'s for every
|
|
412
|
+
* i > 0 — REUSES the core's own relation (authority.ts); not
|
|
413
|
+
* reimplemented here.
|
|
414
|
+
* 5. Time: `now <= exp` (and `now >= nbf` where present) for every DT_i, and
|
|
415
|
+
* `exp` non-increasing along the chain.
|
|
416
|
+
*
|
|
417
|
+
* OUT OF SCOPE, as in the Python reference implementation — documented here
|
|
418
|
+
* rather than silently skipped: step 6 (`cnf`/DPoP holder-binding proof) and
|
|
419
|
+
* step 7 (Token Status List revocation). Neither is checked.
|
|
420
|
+
*/
|
|
421
|
+
export function load(tokens, signer, options = {}) {
|
|
422
|
+
const { rootKeyIds = null, now = 0 } = options;
|
|
423
|
+
if (tokens.length === 0) {
|
|
424
|
+
throw new WireError(WireReasonCode.MALFORMED, "empty token chain");
|
|
425
|
+
}
|
|
426
|
+
const parsed = tokens.map((t) => parseToken(t));
|
|
427
|
+
// ---- step 1: signatures -------------------------------------------------
|
|
428
|
+
const trustedRoots = rootKeyIds === null ? null : new Set(rootKeyIds);
|
|
429
|
+
for (let i = 0; i < parsed.length; i++) {
|
|
430
|
+
const { header, sig, signingInput } = parsed[i];
|
|
431
|
+
const alg = header["alg"];
|
|
432
|
+
if (alg !== signer.alg) {
|
|
433
|
+
throw new WireError(WireReasonCode.SIGNATURE_INVALID, `token[${i}] header alg ${JSON.stringify(alg)} != signer alg ${JSON.stringify(signer.alg)}`);
|
|
434
|
+
}
|
|
435
|
+
const kid = typeof header["kid"] === "string" ? header["kid"] : null;
|
|
436
|
+
if (i === 0 && trustedRoots !== null && !trustedRoots.has(kid)) {
|
|
437
|
+
throw new WireError(WireReasonCode.SIGNATURE_INVALID, `root token kid ${JSON.stringify(kid)} not in trusted rootKeyIds`);
|
|
438
|
+
}
|
|
439
|
+
if (!signer.verify(signingInput, sig, kid)) {
|
|
440
|
+
throw new WireError(WireReasonCode.SIGNATURE_INVALID, `token[${i}] signature does not verify`);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
// ---- step 2: par_hash byte-commitment (constant-time, over hex) ---------
|
|
444
|
+
// The commitment is over the PARENT's signing input — its exact serialized
|
|
445
|
+
// bytes — which is what makes a spliced chain detectable even when the
|
|
446
|
+
// substituted parent is broad enough that subsumption alone would pass it.
|
|
447
|
+
if ("par_hash" in parsed[0].payload) {
|
|
448
|
+
throw new WireError(WireReasonCode.MALFORMED, "DT_0 (del_depth 0) MUST NOT carry par_hash");
|
|
449
|
+
}
|
|
450
|
+
for (let i = 1; i < parsed.length; i++) {
|
|
451
|
+
const expectedHex = createHash("sha256").update(parsed[i - 1].signingInput).digest("hex");
|
|
452
|
+
const gotB64 = parsed[i].payload["par_hash"];
|
|
453
|
+
if (typeof gotB64 !== "string") {
|
|
454
|
+
throw new WireError(WireReasonCode.PAR_HASH_MISMATCH, `token[${i}] missing par_hash`);
|
|
455
|
+
}
|
|
456
|
+
let gotHex;
|
|
457
|
+
try {
|
|
458
|
+
gotHex = b64urlDecode(gotB64).toString("hex");
|
|
459
|
+
}
|
|
460
|
+
catch (e) {
|
|
461
|
+
throw new WireError(WireReasonCode.MALFORMED, `token[${i}] par_hash is not valid base64url: ${String(e)}`);
|
|
462
|
+
}
|
|
463
|
+
if (!constantTimeEqualAscii(expectedHex, gotHex)) {
|
|
464
|
+
throw new WireError(WireReasonCode.PAR_HASH_MISMATCH, `token[${i}] par_hash does not match parent token[${i - 1}]'s signing input ` +
|
|
465
|
+
"(splice, wrong parent, or tampered parent)");
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
// ---- step 3: del_depth / del_max_depth ----------------------------------
|
|
469
|
+
const rootPayload = parsed[0].payload;
|
|
470
|
+
if (rootPayload["del_depth"] !== 0) {
|
|
471
|
+
throw new WireError(WireReasonCode.DEPTH_INVALID, "DT_0.del_depth must be 0");
|
|
472
|
+
}
|
|
473
|
+
const delMaxDepth = rootPayload["del_max_depth"];
|
|
474
|
+
if (typeof delMaxDepth !== "number" ||
|
|
475
|
+
!isIntegerLiteral(parsed[0].payloadRaw["del_max_depth"]) ||
|
|
476
|
+
delMaxDepth <= 0) {
|
|
477
|
+
throw new WireError(WireReasonCode.DEPTH_INVALID, "DT_0.del_max_depth must be a positive integer");
|
|
478
|
+
}
|
|
479
|
+
// `del_max_depth` is the maximum chain LENGTH (a token count) while
|
|
480
|
+
// `del_depth` is a 0-based index, so the leaf's index must be strictly below
|
|
481
|
+
// it — a 3-token chain has a leaf at del_depth 2 and needs del_max_depth >= 3.
|
|
482
|
+
const n = parsed.length - 1;
|
|
483
|
+
if (!(n < delMaxDepth)) {
|
|
484
|
+
throw new WireError(WireReasonCode.DEPTH_INVALID, `chain length ${n + 1} exceeds del_max_depth ${delMaxDepth} ` +
|
|
485
|
+
`(need leaf del_depth ${n} < del_max_depth)`);
|
|
486
|
+
}
|
|
487
|
+
for (let i = 0; i < parsed.length; i++) {
|
|
488
|
+
if (parsed[i].payload["del_depth"] !== i) {
|
|
489
|
+
throw new WireError(WireReasonCode.DEPTH_INVALID, `token[${i}].del_depth = ${JSON.stringify(parsed[i].payload["del_depth"])}, expected ${i}`);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
// ---- step 4: subsumption (reuse Authority.isNarrowerThan) ---------------
|
|
493
|
+
const authorities = parsed.map((p) => authorityFromPayload(p.payload));
|
|
494
|
+
for (let i = 1; i < authorities.length; i++) {
|
|
495
|
+
if (!authorities[i].isNarrowerThan(authorities[i - 1])) {
|
|
496
|
+
throw new WireError(WireReasonCode.NOT_NARROWER, `token[${i}] authority is not narrower than token[${i - 1}]'s ` +
|
|
497
|
+
"(widened scope, loosened/dropped ceiling, or looser ttl)");
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
// ---- step 5: time -------------------------------------------------------
|
|
501
|
+
let prevExp = null;
|
|
502
|
+
for (let i = 0; i < parsed.length; i++) {
|
|
503
|
+
const payload = parsed[i].payload;
|
|
504
|
+
const exp = payload["exp"];
|
|
505
|
+
if (typeof exp !== "number") {
|
|
506
|
+
throw new WireError(WireReasonCode.MALFORMED, `token[${i}] missing numeric exp`);
|
|
507
|
+
}
|
|
508
|
+
// `nbf` is optional; absent or null means "no lower bound". Anything else
|
|
509
|
+
// that is not a number is refused rather than ignored — Python compares it
|
|
510
|
+
// to `now` directly and raises a TypeError that escapes `load()`, so a
|
|
511
|
+
// caller catching only `WireError` would see the chain neither accepted nor
|
|
512
|
+
// cleanly rejected. Failing closed here is the safe reading of both.
|
|
513
|
+
const nbf = payload["nbf"];
|
|
514
|
+
if (nbf !== undefined && nbf !== null) {
|
|
515
|
+
if (typeof nbf !== "number") {
|
|
516
|
+
throw new WireError(WireReasonCode.MALFORMED, `token[${i}] nbf is not numeric`);
|
|
517
|
+
}
|
|
518
|
+
if (now < nbf) {
|
|
519
|
+
throw new WireError(WireReasonCode.EXPIRED, `token[${i}] not yet valid: now=${now} < nbf=${nbf}`);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
if (now > exp) {
|
|
523
|
+
throw new WireError(WireReasonCode.EXPIRED, `token[${i}] expired: now=${now} > exp=${exp}`);
|
|
524
|
+
}
|
|
525
|
+
if (prevExp !== null && exp > prevExp) {
|
|
526
|
+
throw new WireError(WireReasonCode.EXPIRED, `token[${i}] exp=${exp} exceeds parent token[${i - 1}] exp=${prevExp} ` +
|
|
527
|
+
"(exp must be monotonic non-increasing along the chain)");
|
|
528
|
+
}
|
|
529
|
+
prevExp = exp;
|
|
530
|
+
}
|
|
531
|
+
// ---- steps 6-7: OUT OF SCOPE (see the doc comment) ----------------------
|
|
532
|
+
// step 6: cnf/DPoP holder-binding proof — not checked.
|
|
533
|
+
// step 7: Token Status List revocation — not checked.
|
|
534
|
+
return new VerifiedChain([...tokens], parsed.map((p) => p.payload), authorities[authorities.length - 1], parsed[parsed.length - 1].payload["del_depth"], delMaxDepth);
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Did the issuer write an integer, as opposed to a value that merely equals one?
|
|
538
|
+
* `parseJson` keeps every number's original literal precisely so this question
|
|
539
|
+
* can still be asked after parsing.
|
|
540
|
+
*/
|
|
541
|
+
function isIntegerLiteral(value) {
|
|
542
|
+
if (value instanceof RawNumber)
|
|
543
|
+
return /^-?\d+$/.test(value.raw);
|
|
544
|
+
return typeof value === "number" && Number.isInteger(value);
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Compare two ASCII strings without an early exit, so a near-miss and a wild
|
|
548
|
+
* miss take the same time. `timingSafeEqual` throws on unequal lengths, so the
|
|
549
|
+
* length is checked first — that leak is only the digest length, which is fixed
|
|
550
|
+
* and public anyway.
|
|
551
|
+
*/
|
|
552
|
+
function constantTimeEqualAscii(a, b) {
|
|
553
|
+
const ab = Buffer.from(a, "ascii");
|
|
554
|
+
const bb = Buffer.from(b, "ascii");
|
|
555
|
+
return ab.length === bb.length && timingSafeEqual(ab, bb);
|
|
556
|
+
}
|
|
159
557
|
//# sourceMappingURL=wire.js.map
|
package/dist/esm/wire.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire.js","sourceRoot":"","sources":["../../src/wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,IAAI,IAAI,UAAU,EAClB,eAAe,EACf,MAAM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EAAE,EAAE,CAAC,CAAC;AAC5D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "attenu-guard",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Attenu Guard for TypeScript: enforces per-agent permissions on every tool call and sub-agent handoff — a sub-agent never holds more than its parent — and writes a hash-chained audit log you verify offline. Same bundle format as the Python library.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Attenu",
|