@cygnuxlabs/tracekit 1.5.0 → 1.5.1

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/dist/verify.html CHANGED
@@ -3,39 +3,107 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
- <meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'sha256-ewj7iTgJ08EgcgBkS8JtnA/aFjmA75WObFgJm10+jUc='; style-src 'sha256-hGOb6corVyDqUYHluhAwCLbaaMKqsxeEGQkVPYNw5lA='; worker-src blob:; connect-src 'none'">
6
+ <meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'sha256-W7s5GrEWv7gIJ0k+k7CeFuhjUnLzDVa7ffabWdZky4o='; style-src 'sha256-41aEPfNKIK0vxFn3JTgv68G+SOVBoDbHT4QPLHGL360='; worker-src blob:; connect-src 'none'">
7
7
  <title>tracekit verify</title>
8
8
  <style>
9
+ :root {
10
+ color-scheme: dark;
11
+ --bg: #000; --panel: #0d0d0c; --line: #34322e; --text: #e9e4d8; --muted: #8d877a;
12
+ --amber: #ffa630; --green: #3ddc84; --red: #ff5147; --yellow: #ffdd57;
13
+ --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
14
+ }
15
+ @media (prefers-color-scheme: light) {
16
+ :root {
17
+ color-scheme: light;
18
+ --bg: #f4f2ec; --panel: #fbfaf7; --line: #c9c4b8; --text: #1d1b16; --muted: #625d52;
19
+ --amber: #b45309; --green: #13804a; --red: #c0262d; --yellow: #8a6100;
20
+ }
21
+ }
22
+ * { box-sizing: border-box; }
23
+ [hidden] { display: none !important; }
24
+ body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 var(--mono); }
9
25
  main { overflow-wrap: anywhere; }
10
- pre { white-space: pre-wrap; }
26
+ main { max-width: 960px; min-height: 100vh; margin: 0 auto; padding: 24px 16px 40px; }
27
+ main.over { outline: 2px dashed var(--amber); outline-offset: -8px; }
28
+ h1 { margin: 0; font-size: 20px; color: var(--amber); letter-spacing: .04em; }
29
+ h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: .06em; }
30
+ h3 { margin: 28px 0 8px; font-size: 12px; font-weight: normal; letter-spacing: .12em; text-transform: uppercase;
31
+ color: var(--muted); }
32
+ p { margin: 6px 0; }
33
+ .quiet { color: var(--muted); }
34
+ .pick { margin: 16px 0 24px; padding: 12px 14px; border: 1px solid var(--line); background: var(--panel); }
35
+ .row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 6px 0; }
36
+ .row input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
37
+ button, .row label { padding: 4px 10px; border: 1px solid var(--line); background: transparent; color: var(--text);
38
+ font: inherit; cursor: pointer; }
39
+ button:hover, .row label:hover { border-color: var(--amber); color: var(--amber); }
40
+ button:focus-visible, summary:focus-visible, .row input:focus-visible + label {
41
+ outline: 2px solid var(--amber); outline-offset: 2px; }
42
+ .name { font-weight: bold; }
43
+ .banner { margin: 8px 0; padding: 12px 16px; border: 1px solid var(--line); border-left: 4px solid var(--muted);
44
+ background: var(--panel); }
45
+ .banner.ok { border-left-color: var(--green); }
46
+ .banner.bad { border-left-color: var(--red); }
47
+ .banner.warn { border-left-color: var(--yellow); }
48
+ .banner.ok h2 { color: var(--green); }
49
+ .banner.bad h2 { color: var(--red); }
50
+ .banner.warn h2 { color: var(--yellow); }
51
+ ol { margin: 0; padding-left: 1.6em; }
52
+ li { margin: 6px 0; }
53
+ .cmd { display: flex; align-items: flex-start; gap: 8px; margin-top: 4px; }
54
+ .cmd code { flex: 1; min-width: 0; padding: 4px 8px; border: 1px solid var(--line); background: var(--panel);
55
+ white-space: pre-wrap; }
56
+ dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
57
+ dt { color: var(--muted); }
58
+ dd { margin: 0; }
59
+ #checks details { padding: 3px 0; border-bottom: 1px solid var(--line); }
60
+ #checks summary { cursor: pointer; }
61
+ .status { font-weight: bold; }
62
+ .status.ok { color: var(--green); }
63
+ .status.bad { color: var(--red); }
64
+ .status.warn { color: var(--yellow); }
65
+ .problem, .means { margin: 2px 0 2px 2.2em; }
66
+ .means { color: var(--muted); }
67
+ #integrity { margin-top: 20px; font-weight: bold; }
68
+ body[data-state=error] #busy { color: var(--red); }
69
+ pre { margin: 8px 0 0; padding: 12px; border: 1px solid var(--line); background: var(--panel); white-space: pre-wrap; }
70
+ footer { margin-top: 32px; font-size: 12px; color: var(--muted); }
71
+ @media (max-width: 600px) {
72
+ dl { grid-template-columns: 1fr; }
73
+ dd { margin-bottom: 6px; }
74
+ .cmd { flex-direction: column; }
75
+ }
11
76
  </style>
12
77
  </head>
13
78
  <body>
14
79
  <main id="drop">
15
80
  <h1>tracekit verify</h1>
16
- <p><label for="bundle">bundle (.tkb):</label> <input type="file" id="bundle" accept=".tkb,.zip,.json" multiple>
17
- <b id="bundle-name">none chosen</b><br>
18
- <label for="trust">trust.json (optional):</label> <input type="file" id="trust" accept=".json"> <b id="trust-name">none</b>
19
- <button type="button" id="clear-trust" hidden>remove</button><br>
20
- samples: <button type="button" id="sample-clean">clean</button> <button type="button" id="sample-tampered">tampered</button></p>
21
- <hr>
81
+ <p class="quiet">Checks a Tracekit evidence bundle in this page: the files never leave it.</p>
82
+ <section class="pick" aria-label="files to check">
83
+ <div class="row"><input type="file" id="bundle" accept=".tkb,.zip,.json" multiple>
84
+ <label for="bundle">choose bundle (.tkb)</label> <span class="name" id="bundle-name">none chosen</span></div>
85
+ <div class="row"><input type="file" id="trust" accept=".json">
86
+ <label for="trust">choose trust file (.json, optional)</label> <span class="name" id="trust-name">none</span>
87
+ <button type="button" id="clear-trust" hidden>remove</button></div>
88
+ <p class="quiet">or drop the files on this page · samples:
89
+ <button type="button" id="sample-clean">clean</button> <button type="button" id="sample-tampered">tampered</button></p>
90
+ </section>
22
91
  <p id="busy" hidden role="status">Verifying...</p>
23
92
  <section id="result" hidden aria-live="polite">
24
- <div id="banner"><h2 id="verdict-word"></h2><p id="verdict-means"></p><p id="verdict-not"></p></div>
93
+ <div id="banner"><h2 id="verdict-word"></h2><p id="verdict-means"></p><p id="verdict-not" class="quiet"></p></div>
25
94
  <div id="next" hidden><h3>what to do next</h3><ol id="steps"></ol></div>
26
95
  <div id="summary-box" hidden><h3 id="summary-title"></h3><dl id="summary"></dl></div>
27
96
  <h3>checks</h3>
28
97
  <div id="checks"></div>
29
98
  <p id="integrity"></p>
30
99
  <p id="assurance"></p>
31
- <p id="exit"></p>
100
+ <p id="exit" class="quiet"></p>
32
101
  <p><button type="button" id="copy">copy report</button> <button type="button" id="download">download JSON</button>
33
102
  <span id="copied"></span></p>
34
103
  <details><summary>report as text</summary><pre id="report"></pre></details>
35
- <hr>
36
104
  </section>
37
- <p><small>tracekit <span id="version"></span> · same checks as <code>tracekit verify</code> · files never leave this
38
- page</small></p>
105
+ <footer>tracekit <span id="version"></span> · same checks as <code>tracekit verify</code> · files never leave this
106
+ page</footer>
39
107
  </main>
40
108
  <script id="verifier" type="module">const SAMPLES = {"sample.tkb":"UEsDBBQAAAAIAKhNU13VJSVdPgEAAP0BAAANAAAAbWFuaWZlc3QuanNvbm2Oy07sMAyG9/MUVdeoE9u5OOdlUGI7oszQorYgHSHenVQsEBLL/+LP/8dlGNu6vZRj/DeMx1bEbvMx1bdF7za94/jQC++2zW227fFlXh672Od1Oesw4eR+N/5M23y3vVsfl2EYt7dlvxIxaDMRzwEd1KqZok+US7SQgKfnfV3uJ6WaabJkmAmgAQZuPjhzTiSCN0XfiDupcSyFoQi1ELiQJEdeMJ8DhvFm//frZrJuuv+wPbKXUpCpVhaRrMGxAyiueyGfMrmMJeUGhME1TUwuQRc+a23fbHkyub2u83LsV6BpWQ874eoDVucYkQxEPRMjsZnnnIxT1YBKUbXPphQRaymtZ7koacQk3/DXbV3b7+knPDaGyAgOQapIqLH2M9SmzLUvR+mwjDGQeN8fAEElF1pqKUlJcbwMn5fPL1B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AACFcsppxGP8BAAC4AwAAEgAAAAAAAAAAAAAAgAEmEQAAa2V5cy9yZWNvcmRzLmpzb25sUEsBAhQDFAAAAAgAAAAhXDx09XXCAAAA8gAAABMAAAAAAAAAAAAAAIABVRMAAGNoZWNrcG9pbnRzLzEzLm5vdGVQSwECFAMUAAAACAAAACFcwFygZmABAAA7AgAAEwAAAAAAAAAAAAAAgAFIFAAAcHJvb2ZzL3JlY29yZHMuanNvblBLBQYAAAAABQAFAFYBAADZFQAAAAA=","sample.trust.json":"ewogImxvZ3MiOiBbCiAgInRyYWNla2l0LmxvY2FsLzRkYTFjZDk2MjAzYjM0ZDc5YmYwMmI4Mjk2ODM3NzA0KzI4NjEwNDI4K0FXaTVIMGFSWGpYQmRuSElwektXcTJXeWZsM2h5R0RhRTlsRHVBMzByY0hwIgogXSwKICJ3aXRuZXNzZXMiOiBbXSwKICJhbGdzIjogWwogICJlZDI1NTE5IgogXSwKICJ3aXRuZXNzZXNfcmVxdWlyZWQiOiAwCn0="};
41
109
  const __jcs = (() => {
@@ -398,6 +466,25 @@ async function parseVkey(text) {
398
466
  throw new NoteError("vkey id does not match the key");
399
467
  return { name, id, type: raw[0], pub: raw.subarray(1) };
400
468
  }
469
+ /** A cosignature signs no key name and a witness has one key (C2SP tlog-cosignature): refuse pins of one cosignature
470
+ * key under two names, or of two under one name, so each witness counts once. */
471
+ async function checkWitnesses(keys) {
472
+ const names = new Map(), pubs = new Map();
473
+ for (const k of keys) {
474
+ const p = await parseVkey(k);
475
+ if (p.type !== COSIGNATURE)
476
+ continue;
477
+ const pub = hex(p.pub), name = names.get(pub) ?? p.name, other = pubs.get(p.name) ?? pub;
478
+ if (name !== p.name)
479
+ throw new NoteError(`trust pins one witness key under two names (${name}, ${p.name}); a key is one witness: `
480
+ + "keep it under the name it cosigns with");
481
+ if (other !== pub)
482
+ throw new NoteError(`trust pins two witness keys under one name (${p.name}); a name is one witness: keep only `
483
+ + "its current key");
484
+ names.set(pub, name);
485
+ pubs.set(p.name, pub);
486
+ }
487
+ }
401
488
  /**
402
489
  * Open a checkpoint note with pinned vkeys: a pinned Ed25519 log key named after the origin must sign it, and each
403
490
  * pinned hybrid key of the origin must have a line. Web Crypto has no SLH-DSA, so a hybrid line is left `unchecked`.
@@ -437,6 +524,7 @@ async function openNote(data, logKeys, witnessKeys, anchored = true) {
437
524
  }
438
525
  if (root.length !== 32)
439
526
  throw new NoteError("bad root hash");
527
+ await checkWitnesses(witnessKeys);
440
528
  const pinned = new Map();
441
529
  for (const [keys, want] of [[logKeys, [ED25519, HYBRID]], [witnessKeys, [COSIGNATURE]]])
442
530
  for (const k of keys) {
@@ -505,7 +593,7 @@ function parseLeaf(data) {
505
593
  seq: Number(new DataView(data.buffer, data.byteOffset).getBigUint64(49)), hash: "sha256:" + hex(data.subarray(57)) };
506
594
  }
507
595
 
508
- return { COSIGNATURE, ED25519, HYBRID, LEAF_TYPES, NoteError, SIGNER_LEAVES, SLH_DSA, b64decode, b64encode, bytes, concat, ed25519Verify, equal, hex, keyAlg, keyId, leafHash, openNote, parseLeaf, parseVkey, registryOrigin, runHash, sha256, sha256hex, spkiKid, spkiOf, unb64, unhex, verifyConsistency, verifyInclusion, verifyV2, vkey };
596
+ return { COSIGNATURE, ED25519, HYBRID, LEAF_TYPES, NoteError, SIGNER_LEAVES, SLH_DSA, b64decode, b64encode, bytes, checkWitnesses, concat, ed25519Verify, equal, hex, keyAlg, keyId, leafHash, openNote, parseLeaf, parseVkey, registryOrigin, runHash, sha256, sha256hex, spkiKid, spkiOf, unb64, unhex, verifyConsistency, verifyInclusion, verifyV2, vkey };
509
597
  })();
510
598
  const __detect = (() => {
511
599
  const RUN_CAP = 100, TENANT_CAP = 60, RUN_SHARE = 20, IDLE_S = 3600, UPDATE_S = 60;
@@ -917,7 +1005,8 @@ const MAX_TOTAL = 512 << 20;
917
1005
  const NAME = /^[A-Za-z0-9_-][A-Za-z0-9._-]*(\/[A-Za-z0-9._-]+)*$/;
918
1006
  class Unusable extends Error {
919
1007
  }
920
- /** An entry whose bytes don't match its CRC-32: Python's zipfile names it so, and the reports print the name. */
1008
+ /** A file that isn't a zip, has no manifest, or an entry whose bytes don't inflate or don't match its CRC-32: the
1009
+ * reports say the bundle file is damaged. */
921
1010
  class BadZipFile extends Unusable {
922
1011
  }
923
1012
  let CRC;
@@ -970,7 +1059,7 @@ async function readZip(data) {
970
1059
  };
971
1060
  const eocd = data.length - 22;
972
1061
  if (eocd < 0 || v.getUint32(eocd, true) !== 0x06054b50)
973
- throw new Unusable("not a zip file, or bytes after its end record");
1062
+ throw new BadZipFile("not a zip file, or bytes after its end record");
974
1063
  const count = v.getUint16(eocd + 10, true), cdSize = v.getUint32(eocd + 12, true), cdOffset = v.getUint32(eocd + 16, true);
975
1064
  if (v.getUint16(eocd + 4, true) || v.getUint16(eocd + 6, true) || v.getUint16(eocd + 8, true) !== count
976
1065
  || v.getUint16(eocd + 20, true) || cdOffset + cdSize !== eocd)
@@ -1041,7 +1130,7 @@ async function readZip(data) {
1041
1130
  }
1042
1131
  catch (x) {
1043
1132
  // lean: the decompressor's own message, which differs from zlib's in the reference verifier's report
1044
- throw new Unusable(`${n}: ${x.message}`);
1133
+ throw new BadZipFile(`${n} does not inflate` + (x.message ? `: ${x.message}` : ""));
1045
1134
  }
1046
1135
  }
1047
1136
  if (out.length > cap)
@@ -1056,7 +1145,7 @@ async function readZip(data) {
1056
1145
  return files;
1057
1146
  }
1058
1147
 
1059
- return { MAX_ENTRIES, MAX_ENTRY, MAX_TOTAL, Unusable, readZip };
1148
+ return { BadZipFile, MAX_ENTRIES, MAX_ENTRY, MAX_TOTAL, Unusable, readZip };
1060
1149
  })();
1061
1150
  const __index = (() => {
1062
1151
  /**
@@ -1078,18 +1167,20 @@ const __index = (() => {
1078
1167
  * `verify(bundle, null)` (no trust config) checks what needs no pinned key and is never VERIFIED. web.ts is this
1079
1168
  * verifier as a browser page (verify.html).
1080
1169
  */
1081
- const { canonicalize: canonicalize, repr: quoted, strictParseBytes: strictParseBytes } = __jcs;
1082
- const { HYBRID: HYBRID, NoteError: NoteError, SIGNER_LEAVES: SIGNER_LEAVES, b64decode: b64decode, bytes: bytes, equal: equal, keyAlg: keyAlg, leafHash: leafHash, openNote: openNote, parseLeaf: parseLeaf, parseVkey: parseVkey, registryOrigin: registryOrigin, runHash: runHash, sha256hex: sha256hex, spkiKid: spkiKid, unhex: unhex, verifyConsistency: verifyConsistency, verifyInclusion: verifyInclusion, verifyV2: verifyV2, vkey: vkey } = __primitives;
1170
+ const { StrictJSONError: StrictJSONError, canonicalize: canonicalize, repr: quoted, strictParseBytes: strictParseBytes } = __jcs;
1171
+ const { HYBRID: HYBRID, NoteError: NoteError, SIGNER_LEAVES: SIGNER_LEAVES, b64decode: b64decode, bytes: bytes, checkWitnesses: checkWitnesses, equal: equal, keyAlg: keyAlg, leafHash: leafHash, openNote: openNote, parseLeaf: parseLeaf, parseVkey: parseVkey, registryOrigin: registryOrigin, runHash: runHash, sha256hex: sha256hex, spkiKid: spkiKid, unhex: unhex, verifyConsistency: verifyConsistency, verifyInclusion: verifyInclusion, verifyV2: verifyV2, vkey: vkey } = __primitives;
1083
1172
  const { Detector: Detector } = __detect;
1084
1173
  const { same: same, validateEvent: validateEvent } = __schema;
1085
- const { MAX_ENTRY: MAX_ENTRY, Unusable: Unusable, readZip: readZip } = __zip;
1174
+ const { BadZipFile: BadZipFile, MAX_ENTRY: MAX_ENTRY, Unusable: Unusable, readZip: readZip } = __zip;
1086
1175
 
1087
1176
 
1088
1177
  /** The bundle format version this verifier implements: a bundle needing a later one is UNVERIFIABLE. */
1089
- const VERSION = "1.5.0";
1178
+ const VERSION = "1.5.1";
1090
1179
  /** The browser verifier of the latest release (docs/RELEASING.md). */
1091
1180
  const PAGE = "https://cygnux-labs.github.io/Tracekit/verify/";
1092
1181
  const EXIT_OK = 0, EXIT_FAIL = 1, EXIT_BAD = 2, EXIT_WARN = 3;
1182
+ /** The integrity of a trust config that can't be used: nothing in the bundle was checked. */
1183
+ const TRUST_UNUSABLE = "UNVERIFIABLE (the trust file can't be used)";
1093
1184
  const FORMAT = "tracekit.bundle.v2";
1094
1185
  const MAX_LINE = 1 << 20;
1095
1186
  const MIN_RECORD = 256; // no signed record's line is shorter: its hash, signature, ids and timestamp alone are longer
@@ -1147,6 +1238,9 @@ function manifestDetail(listed, hashes, bad) {
1147
1238
  : Object.hasOwn(listed, n) ? "missing" : "not listed"})`);
1148
1239
  return "files differ from the manifest: " + how.join(", ") + (bad.length > 5 ? ` and ${bad.length - 5} more` : "");
1149
1240
  }
1241
+ /** A check's detail: what it found when it passed, else how many problems in what (its lines say which), so a failed
1242
+ * line never reads as a pass. */
1243
+ const found = (problems, passed, scope) => problems.length ? `${problems.length} problem(s) in ${scope}` : passed;
1150
1244
  const kind = (v) => v === null ? "null" : Array.isArray(v) ? "array" : typeof v;
1151
1245
  function at(o, k) {
1152
1246
  if (!isObj(o))
@@ -1240,13 +1334,30 @@ async function loadTrust(data, name) {
1240
1334
  && Array.isArray(opt(t, "issuers")) && opt(t, "issuers").every((i) => exactly(i, ["vkey", "issuance_log_vkey"])
1241
1335
  && Object.values(i).every((v) => typeof v === "string"))
1242
1336
  && Array.isArray(opt(t, "analyzers"))
1243
- && opt(t, "analyzers").every((a) => typeof a === "string" && /^[a-z0-9_]+:.+$/.test(a));
1337
+ && opt(t, "analyzers").every((a) => typeof a === "string" && /^[a-z0-9_]+:[^\n]+$/.test(a));
1244
1338
  if (!ok)
1245
1339
  throw new ValueError(`${name}: not a v2 trust config (logs, witnesses, algs, witnesses_required, rekor, monitors, `
1246
1340
  + "issuers, analyzers)");
1247
1341
  for (const k of [...t.logs, ...opt(t, "witnesses").map((w) => w.vkey), ...opt(t, "monitors").map((m) => m.vkey),
1248
- ...opt(t, "issuers").flatMap((i) => Object.values(i))])
1249
- await parseVkey(k);
1342
+ ...opt(t, "issuers").flatMap((i) => Object.values(i))]) {
1343
+ try {
1344
+ await parseVkey(k);
1345
+ }
1346
+ catch (e) {
1347
+ if (!(e instanceof NoteError))
1348
+ throw e;
1349
+ throw new ValueError(`pinned key ${repr(cut(k, 80))} is not a vkey: ${e.message}`);
1350
+ }
1351
+ }
1352
+ await checkWitnesses(opt(t, "witnesses").map((w) => w.vkey));
1353
+ const classes = new Map();
1354
+ for (const w of opt(t, "witnesses")) {
1355
+ const c = classes.get(w.vkey) ?? w.class;
1356
+ if (c !== w.class)
1357
+ throw new ValueError(`trust pins witness ${w.vkey.split("+")[0]} with two classes (${c}, `
1358
+ + `${w.class}); a witness has one class: list it once, with the class you give it`);
1359
+ classes.set(w.vkey, c);
1360
+ }
1250
1361
  t.witnesses ??= [];
1251
1362
  t.witnesses_required ??= 0;
1252
1363
  t.issuers ??= [];
@@ -1295,7 +1406,9 @@ async function verify(bundle, trust, names = { bundle: "BUNDLE", trust: "TRUST.j
1295
1406
  t = await loadTrust(trust, names.trust);
1296
1407
  }
1297
1408
  catch (e) {
1298
- rep.check("trust config", false, errorText(e));
1409
+ rep.integrity = TRUST_UNUSABLE;
1410
+ rep.check("trust config", false, e instanceof StrictJSONError ? `not valid JSON (${e.message})`
1411
+ : e instanceof ValueError || e instanceof NoteError ? e.message : errorText(e));
1299
1412
  return { report: rep, code: EXIT_BAD };
1300
1413
  }
1301
1414
  const floats = new WeakMap();
@@ -1303,7 +1416,7 @@ async function verify(bundle, trust, names = { bundle: "BUNDLE", trust: "TRUST.j
1303
1416
  files = await readZip(bundle);
1304
1417
  const m = files.get("manifest.json");
1305
1418
  if (!m)
1306
- throw new KeyError(repr("manifest.json"));
1419
+ throw new BadZipFile("no manifest.json");
1307
1420
  files.delete("manifest.json");
1308
1421
  manifest = strictParseBytes(m, floats);
1309
1422
  v1 = isObj(manifest) && manifest.format === "tracekit.bundle.v1";
@@ -1320,7 +1433,9 @@ async function verify(bundle, trust, names = { bundle: "BUNDLE", trust: "TRUST.j
1320
1433
  }
1321
1434
  catch (e) {
1322
1435
  // a format v1 bundle (the laptop signer's): the reference verifier checks it, against the signer.pub the sender pins
1323
- rep.check("bundle readable", false, `cannot read bundle: ${errorText(e)}`, v1 ? ["a format v1 bundle: verify it with "
1436
+ const why = e instanceof BadZipFile ? `the bundle file is damaged: ${e.message}`
1437
+ : e instanceof Unusable ? e.message : errorText(e);
1438
+ rep.check("bundle readable", false, `cannot read bundle: ${why}`, v1 ? ["a format v1 bundle: verify it with "
1324
1439
  + `the signer's public key (signer.pub, from the sender): uvx --from tracekit-ai tracekit verify ${quote(names.bundle)}`
1325
1440
  + " --key signer.pub"] : []);
1326
1441
  return { report: rep, code: EXIT_BAD };
@@ -1390,8 +1505,10 @@ async function check(rep, manifest, files, trust, floats) {
1390
1505
  return;
1391
1506
  }
1392
1507
  const { origin, size, root, cosigs } = note;
1393
- rep.check("checkpoint", same(size, at(proofs, "tree_size")), `${origin} at tree size ${size}, `
1394
- + (anchored ? "signed by its pinned log key" : "its signature not checked (no trust config)"));
1508
+ const sized = same(size, at(proofs, "tree_size"));
1509
+ rep.check("checkpoint", sized, `${origin} at tree size ${size}, `
1510
+ + (anchored ? "signed by its pinned log key" : "its signature not checked (no trust config)")
1511
+ + (sized ? "" : ", but the proofs are for another tree size"));
1395
1512
  if (note.unchecked)
1396
1513
  rep.unsupport("SLH-DSA-SHA2-128s checkpoint signature");
1397
1514
  if (anchored)
@@ -1507,8 +1624,8 @@ async function check(rep, manifest, files, trust, floats) {
1507
1624
  extend(keyProblems, retired.filter(([seq, h]) => !keyed.has(`${seq} ${h}`))
1508
1625
  .map(([seq]) => `seq ${seq}: key.retire withheld (the registry log has it)`));
1509
1626
  }
1510
- rep.check("keys", timeline.size > 0 && !keyProblems.length, `${timeline.size} record key(s) from ${keyRecords.length} key `
1511
- + "record(s)", keyProblems);
1627
+ rep.check("keys", timeline.size > 0 && !keyProblems.length, found(keyProblems, timeline.size ? `${timeline.size} record `
1628
+ + `key(s) from ${keyRecords.length} key record(s)` : "no key record declares a record key", `${keyRecords.length} key record(s)`), keyProblems);
1512
1629
  const every = [...runs.values()].flat();
1513
1630
  const seqs = [...keyRecords, ...every].map((r) => num(at(at(r, "event"), "seq")));
1514
1631
  if (!seqs.length)
@@ -1523,19 +1640,19 @@ async function check(rep, manifest, files, trust, floats) {
1523
1640
  + "its signer.pub to the reference verifier to check the format bridge");
1524
1641
  const inParts = [...names].filter(([n, ps]) => !(ps.length === 1 && ps[0] === n)).map(([, ps]) => ps.length);
1525
1642
  if (inParts.length)
1526
- rep.check("run parts", !layout.length, `${inParts.length} run(s) in ${inParts.reduce((a, b) => a + b, 0)} parts, `
1527
- + "each part continuing the one before it", layout);
1528
- rep.check("signatures", !problems.length, `${every.length} record(s), keys valid at their position`, problems);
1643
+ rep.check("run parts", !layout.length, found(layout, `${inParts.length} run(s) in ${inParts.reduce((a, b) => a + b, 0)} `
1644
+ + "parts, each part continuing the one before it", `the parts of ${inParts.length} run(s)`), layout);
1645
+ rep.check("signatures", !problems.length, found(problems, `${every.length} record(s), keys valid at their position`, `${every.length} record(s)`), problems);
1529
1646
  const only = runs.size === 1 ? [...runs.values()][0][0].event : null;
1530
- rep.check("run chain", !chain.length, only ? `run ${repr(cut(str(get(only, "run_id")), 200))} of tenant `
1531
- + `${repr(get(only, "tenant"))}, contiguous from run_seq 0` : `${runs.size} run(s), each contiguous from run_seq 0`, chain);
1532
- rep.check("inclusion", !outside.length, `first and last records of ${runs.size} run(s) are in the checkpointed tree of `
1533
- + `size ${size}`, outside);
1647
+ rep.check("run chain", !chain.length, found(chain, only ? `run ${repr(cut(str(get(only, "run_id")), 200))} of tenant `
1648
+ + `${repr(get(only, "tenant"))}, contiguous from run_seq 0` : `${runs.size} run(s), each contiguous from run_seq 0`, `the chain of ${runs.size} run(s)`), chain);
1649
+ rep.check("inclusion", !outside.length, found(outside, `first and last records of ${runs.size} run(s) are in the `
1650
+ + `checkpointed tree of size ${size}`, `the first and last records of ${runs.size} run(s)`), outside);
1534
1651
  // policy_hash -> the bundled snapshot named by it: the one set checkIncidents and approvals check against
1535
1652
  const policies = new Map();
1536
1653
  for (const p of [...files.keys()].filter((n) => n.startsWith("policies/")).sort()) {
1537
1654
  const hex = await sha256hex(file(p));
1538
- rep.check("policy snapshot", p === `policies/${hex}.json`, p);
1655
+ rep.check("policy snapshot", p === `policies/${hex}.json`, p === `policies/${hex}.json` ? p : `${p} is not named by the SHA-256 of its bytes`);
1539
1656
  if (p === `policies/${hex}.json`)
1540
1657
  policies.set(`sha256:${hex}`, file(p));
1541
1658
  }
@@ -1844,9 +1961,9 @@ function approvals(rep, runs, policies, floats) {
1844
1961
  if (!agents)
1845
1962
  return; // a bundle without agent approvals keeps the report it always had
1846
1963
  rep.check("approvals by people", true, `${people} approval(s) answered by people`);
1847
- rep.check("approvals by agents", !problems.length && !unchecked.length, `${agents} approval(s) answered by agents (model `
1848
- + "output); argument bounds are not checkable offline (salted commitments): audit one with `tracekit signer reveal`"
1849
- + (unchecked.length ? `; agent approval bounds unchecked for ${unchecked.length}` : ""), (problems.length ? problems : unchecked).slice(0, 20), !problems.length);
1964
+ rep.check("approvals by agents", !problems.length && !unchecked.length, found(problems, `${agents} approval(s) answered `
1965
+ + "by agents (model output); argument bounds are not checkable offline (salted commitments): audit one with "
1966
+ + "`tracekit signer reveal`" + (unchecked.length ? `; agent approval bounds unchecked for ${unchecked.length}` : ""), `${agents} approval(s) answered by agents`), (problems.length ? problems : unchecked).slice(0, 20), !problems.length);
1850
1967
  }
1851
1968
  const CONTAINMENT = ["incident.opened", "incident.updated", "run.held", "run.quarantined", "run.resumed"];
1852
1969
  const FIRES = ["policy.decision", "approval.consumed", "capture.gap", "trace.tamper", "refusal.summary",
@@ -1947,8 +2064,8 @@ function checkReviews(rep, runs, pinned) {
1947
2064
  extend(labels, Array(signed.length).fill(label));
1948
2065
  }
1949
2066
  if (total) {
1950
- rep.check("reviews", !problems.length && !selfs.length, `${total} review(s): `
1951
- + count(labels).map(([k, n]) => `${n} ${k}`).join(", "), (problems.length ? problems : selfs).slice(0, 20), !problems.length);
2067
+ const said = `${total} review(s): ` + count(labels).map(([k, n]) => `${n} ${k}`).join(", ");
2068
+ rep.check("reviews", !problems.length && !selfs.length, found(problems, said, said), (problems.length ? problems : selfs).slice(0, 20), !problems.length);
1952
2069
  const verdicts = [...runs.values()].flatMap((rs) => rs.map((r) => r.event)) // signed findings only
1953
2070
  .filter((e) => get(e, "type") === "review" && has(at(e, "data"), "cites")).map((e) => get(e.data, "verdict"));
1954
2071
  const sev = count(verdicts.filter((v) => isObj(v) && get(v, "kind") === "finding")
@@ -1986,7 +2103,8 @@ function checkConstraints(rep, runs) {
1986
2103
  }
1987
2104
  }
1988
2105
  if (added || held)
1989
- rep.check("constraints", !problems.length, `${added} live constraint(s) added; ${held} call(s) held by them`, problems.slice(0, 20));
2106
+ rep.check("constraints", !problems.length, found(problems, `${added} live constraint(s) added; ${held} call(s) held `
2107
+ + "by them", "the calls held by live constraints"), problems.slice(0, 20));
1990
2108
  }
1991
2109
  /** The `incidents` line, as verify/v2.py's _incidents: cited records, incidents recomputed from their run under the
1992
2110
  * bundled compiled policy (`policies`, by policy_hash), responses honoured. */
@@ -2059,8 +2177,8 @@ function checkIncidents(rep, runs, policies, floats) {
2059
2177
  extend(problems, honoured(events, pointers));
2060
2178
  }
2061
2179
  const n = opened.size + [...pointers].filter((p) => !opened.has(p)).length;
2062
- rep.check("incidents", !problems.length, `${n} incident(s): ${checked} checked against the bundle, ${n - checked} `
2063
- + "signer-asserted (operator, cross-run, under several policies, or under a policy not in the bundle)", problems.slice(0, 20));
2180
+ rep.check("incidents", !problems.length, found(problems, `${n} incident(s): ${checked} checked against the bundle, `
2181
+ + `${n - checked} signer-asserted (operator, cross-run, under several policies, or under a policy not in the bundle)`, `${n} incident(s)`), problems.slice(0, 20));
2064
2182
  if (unbundled.size)
2065
2183
  rep.check("incident policies", false, `${unbundled.size} cited policy(ies) not in the bundle: their incidents are `
2066
2184
  + "signer-asserted, not recomputed (export the run with the signer's config, which bundles the policies its "
@@ -2345,6 +2463,8 @@ async function assurance(origin, cosigs, witnesses, trust, algs, selfApproved, r
2345
2463
  /** `x` without control characters and the bidirectional and zero-width format characters that would reorder or hide
2346
2464
  * the text around them, as the report prints bundle-derived strings. */
2347
2465
  const clean = (x) => x.replace(/[\x00-\x1f\x7f-\x9f\u061c\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff]/g, "");
2466
+ /** The Assurance line as the reports print it: an assurance level rates only evidence that verified. */
2467
+ const assuranceLine = (rep) => `Assurance: ${rep.integrity === "FAILED" ? "not rated (the bundle failed verification)" : clean(rep.assurance)}.`;
2348
2468
  /** The report as text, as the reference CLI prints it; `clean` drops characters from bundle-derived strings. */
2349
2469
  function formatReport(rep) {
2350
2470
  let s = "";
@@ -2353,11 +2473,11 @@ function formatReport(rep) {
2353
2473
  for (const p of c.problems)
2354
2474
  s += ` ${clean(p)}\n`;
2355
2475
  }
2356
- return s + `\nIntegrity: ${clean(rep.integrity)}.\nAssurance: ${clean(rep.assurance)}.\n`
2476
+ return s + `\nIntegrity: ${clean(rep.integrity)}.\n${assuranceLine(rep)}\n`
2357
2477
  + (rep.findings ? `Findings: ${clean(rep.findings)}.\n` : "");
2358
2478
  }
2359
2479
 
2360
- return { EXIT_BAD, EXIT_FAIL, EXIT_OK, EXIT_WARN, Report, VERSION, clean, formatReport, runFiles, verify, verifyRecord, MAX_ENTRIES: __zip.MAX_ENTRIES, MAX_ENTRY: __zip.MAX_ENTRY, MAX_TOTAL: __zip.MAX_TOTAL, Unusable: __zip.Unusable, readZip: __zip.readZip, StrictJSONError: __jcs.StrictJSONError, canonicalize: __jcs.canonicalize, strictParse: __jcs.strictParse, strictParseBytes: __jcs.strictParseBytes };
2480
+ return { EXIT_BAD, EXIT_FAIL, EXIT_OK, EXIT_WARN, Report, TRUST_UNUSABLE, VERSION, assuranceLine, clean, formatReport, runFiles, verify, verifyRecord, MAX_ENTRIES: __zip.MAX_ENTRIES, MAX_ENTRY: __zip.MAX_ENTRY, MAX_TOTAL: __zip.MAX_TOTAL, Unusable: __zip.Unusable, readZip: __zip.readZip, StrictJSONError: __jcs.StrictJSONError, canonicalize: __jcs.canonicalize, strictParse: __jcs.strictParse, strictParseBytes: __jcs.strictParseBytes };
2361
2481
  })();
2362
2482
  const __explain = (() => {
2363
2483
  /**
@@ -2378,6 +2498,8 @@ const asJson = (rep, code) => ({ exit_code: code, checks: rep.checks, failures:
2378
2498
  const asText = (rep, code) => formatReport(rep) + `\nExit code ${code}`
2379
2499
  + (code === EXIT_OK && rep.warnings.length ? ` (3 with --strict: ${rep.warnings.length} warning(s))` : "") + ".\n";
2380
2500
  const failed = (rep, name) => rep.checks.find((c) => c.check === name && c.status === "fail");
2501
+ /** Only the witness quorum failed: too few of the witnesses the trust file pins cosigned; the records verified. */
2502
+ const quorumOnly = (rep) => rep.failures.length === 1 && failed(rep, "witness quorum");
2381
2503
  const anchored = (rep) => !rep.checks.some((c) => c.check === "trust config" && c.status === "warn");
2382
2504
  const v1 = (rep) => rep.checks.some((c) => c.check === "bundle readable"
2383
2505
  && c.problems.some((p) => p.startsWith("a format v1 bundle")));
@@ -2406,22 +2528,29 @@ function verdict(rep, code) {
2406
2528
  return { word: "FAILED", means: "This bundle is not signed by the signer your trust file names, or its checkpoint "
2407
2529
  + "was changed.", notMeans: "It doesn't say who made the bundle. If the trust file is the right one, don't rely "
2408
2530
  + "on the bundle." };
2531
+ const quorum = quorumOnly(rep);
2532
+ if (quorum)
2533
+ return { word: "FAILED", means: `Too few of the witnesses your trust file pins cosigned this bundle's checkpoint `
2534
+ + `(${clean(quorum.detail)}). Nothing else failed.`,
2535
+ notMeans: "It doesn't mean the contents were changed: a witness name or key in your trust file that differs from "
2536
+ + "the one the witness signs with gives this same result." };
2409
2537
  return { word: "FAILED", means: "This bundle doesn't match what was signed: something in it was changed, removed or "
2410
2538
  + `added after signing. Failed: ${rep.failures.join(", ")}.`,
2411
2539
  notMeans: "It doesn't say who changed it or why: the failed lines below show what doesn't match." };
2412
2540
  }
2413
2541
  const readable = rep.checks.find((c) => c.check === "bundle readable");
2414
2542
  const nothing = "Nothing failed: it doesn't mean the bundle is bad.";
2543
+ // the word the command-line verifiers print in the Integrity line
2544
+ const word = rep.integrity === "UNUSABLE BUNDLE" ? "UNUSABLE BUNDLE" : "UNVERIFIABLE";
2415
2545
  if (failed(rep, "trust config"))
2416
- return { word: "UNVERIFIABLE", means: "The trust file couldn't be used, so nothing was checked.", notMeans: nothing };
2546
+ return { word, means: "The trust file couldn't be used, so nothing in the bundle was checked.", notMeans: nothing };
2417
2547
  if (v1(rep))
2418
- return { word: "UNVERIFIABLE", means: "This is a format v1 bundle (from Tracekit's laptop signer); this page checks "
2419
- + "format v2 bundles, so nothing was checked.", notMeans: nothing };
2548
+ return { word, means: "This is a format v1 bundle (from Tracekit's laptop signer); this page checks format v2 "
2549
+ + "bundles, so nothing was checked.", notMeans: nothing };
2420
2550
  if (rep.integrity.startsWith("UNVERIFIABLE (needs"))
2421
- return { word: "UNVERIFIABLE", means: `This bundle needs a newer verifier than this page (Tracekit ${VERSION}).`,
2422
- notMeans: nothing };
2551
+ return { word, means: `This bundle needs a newer verifier than this page (Tracekit ${VERSION}).`, notMeans: nothing };
2423
2552
  if (readable)
2424
- return { word: "UNVERIFIABLE", means: "This file couldn't be read as a Tracekit bundle, so nothing in it was checked.",
2553
+ return { word, means: "This file couldn't be read as a Tracekit bundle, so nothing in it was checked.",
2425
2554
  notMeans: "Nothing in it can be relied on until a readable copy verifies." };
2426
2555
  if (!anchored(rep))
2427
2556
  return { word: "UNVERIFIABLE", means: "Signatures are intact, but you haven't said whose signer you trust.",
@@ -2439,8 +2568,10 @@ function nextSteps(rep, code, names) {
2439
2568
  if (code === EXIT_OK)
2440
2569
  return rep.warnings.length ? [{ text: `Read the ${rep.warnings.length} warning(s) below: each says what to look at. `
2441
2570
  + "They don't change the verdict (with --strict the command line exits 3)." }] : [];
2442
- if (failed(rep, "trust config"))
2443
- return [{ text: `Choose the trust file again: it must be a Tracekit v2 trust config (a .json with "logs"). Ask for ${TRUST_FILE}.` }];
2571
+ const trustFile = failed(rep, "trust config");
2572
+ if (trustFile)
2573
+ return [{ text: `Fix the trust file, or choose the right one: ${clean(trustFile.detail)}. If it isn't the sender's, `
2574
+ + `ask for ${TRUST_FILE}.` }];
2444
2575
  if (readable?.problems.length)
2445
2576
  return readable.problems.map((p) => {
2446
2577
  const at = p.search(/(npx|uvx) /);
@@ -2456,6 +2587,10 @@ function nextSteps(rep, code, names) {
2456
2587
  if (failed(rep, "checkpoint") && anchored(rep))
2457
2588
  steps.push({ text: `Make sure the trust file is ${TRUST_FILE.replace("the sender's", "the sender's own")}. With `
2458
2589
  + "the right one, this bundle isn't theirs: don't rely on it." });
2590
+ else if (quorumOnly(rep))
2591
+ steps.push({ text: "Check the witness names and keys in your trust file: each must be the name and key the "
2592
+ + "witness cosigns with. If they are, ask the sender for a copy exported after the witnesses you require "
2593
+ + "cosigned." });
2459
2594
  else
2460
2595
  steps.push({ text: "Don't rely on this bundle's contents. Ask the sender for the original and compare its SHA-256 "
2461
2596
  + "with theirs:", command: `shasum -a 256 ${b}` });
@@ -2471,56 +2606,153 @@ function nextSteps(rep, code, names) {
2471
2606
  return [{ text: "Verify it with the reference verifier, which checks this:",
2472
2607
  command: `uvx --from tracekit-ai tracekit verify ${b} --trust ${t}` }];
2473
2608
  }
2474
- /** One line per check: what it means (docs/verdicts.md#lines). */
2609
+ /** What each line means, for each outcome it can have (docs/verdicts.md#lines): a line that fails or warns never reads
2610
+ * as a pass. */
2475
2611
  const MEANING = {
2476
- "trust config": "Your trust file: the log key and witnesses you trust, never ones the bundle brings.",
2477
- "bundle readable": "The file is a Tracekit v2 bundle this verifier can read.",
2478
- "bundle structure": "The bundle is well formed; a failure here means it is malformed in a way no other line covers.",
2479
- "manifest": "The files in the bundle are exactly those its manifest lists, with those hashes.",
2480
- "checkpoint": "The log's checkpoint (the signed root of every record) is signed by the log key your trust file pins.",
2481
- "witness quorum": "Enough witnesses your trust file pins cosigned the checkpoint: they vouch it was not rolled back.",
2482
- "keys": "The record keys were declared by records the checkpoint includes, in order, and retired keys stop signing.",
2483
- "run parts": "A long run comes in numbered parts: none is missing between the first and the last, extra or out of "
2484
- + "order, so they read as one run. Parts cut off its end leave it open, never VERIFIED.",
2485
- "signatures": "Every record's signature verifies under a key valid at its position: no record was edited after signing.",
2486
- "run chain": "Each run's records follow one another without a gap from the first: none deleted, swapped or added.",
2487
- "inclusion": "Each run's first and last records are in the checkpointed tree: the run wasn't rebuilt.",
2488
- "policy snapshot": "The bundled policy file is named by its own hash: it wasn't edited.",
2489
- "policy": "A tool call ran against a deny, or an ask nobody approved, and the signer recorded it.",
2490
- "held calls": "A call held for a gateway or executor got no result before its run ended.",
2491
- "gaps": "The signer recorded something a person should read: a gap, a tamper attempt or a mismatched approval.",
2492
- "external decisions": "Decisions imported from another policy system, and whether they disagreed with the signer's.",
2493
- "coverage": "Which capture layers reported, and calls the signer could not match across them.",
2494
- "coverage matrix": "How each kind of action was covered: enforced, observed, only reported by the agent, or not at all.",
2495
- "observers": "An observer outside the agent went silent or restarted while the run was open.",
2496
- "reviews": "Signed findings about the run, each labelled by who wrote it: independent, unpinned or self-asserted.",
2497
- "reviews counted": "Findings whose analysed run isn't in the bundle, so their citations weren't checked.",
2498
- "incidents": "Detections the signer opened, recomputed from the run's records where the bundle allows.",
2499
- "incident policies": "Policies an incident cites that aren't in the bundle: those incidents are the signer's word.",
2500
- "content vault": "Who read or erased retained content, as the signer recorded it.",
2501
- "tiers": "Tool calls by how they were captured: T2 gateway or executor, T1 adapter, T3 import (receipt only).",
2502
- "args source": "Whether recorded arguments are the model's exact bytes (raw), parsed, or changed by a framework.",
2503
- "isolation": "How the signer measured its separation from the agent: separate-user and remote are out of its reach.",
2504
- "principals": "The person or service each run acted for, attested by the signer or asserted by the app.",
2505
- "harness": "The agent harness the signer bound each run to.",
2506
- "fail-open classes": "Tool classes allowed to run while the signer is down, so such calls may be unrecorded.",
2507
- "key assurance": "Whether the record keys are only declared by the log (asserted) or certified by an issuer.",
2508
- "approvals by people": "Held calls approved by people.",
2509
- "approvals by agents": "Held calls approved by agents (model output), checked against the rules that allow it.",
2510
- "break-glass approvals": "Approvals given under the break-glass role, with who and why.",
2511
- "not interpreted": "Records carry an extension this verifier doesn't read. They verified like every other record.",
2512
- "gateway amendments": "Requests the LLM gateway changed so the provider shows its reasoning; each record commits to "
2513
- + "the request as sent.",
2514
- "openshell policy": "Changes of the sandbox's policy or configuration that NVIDIA OpenShell reported, signed into "
2515
- + "the run as OpenShell's report.",
2516
- "constraints": "What the person's request said not to do, added while the run was open, and the calls it held.",
2517
- "run-set": "Every run of the tenant in the registry range is in the bundle (COMPLETE), or what is missing.",
2518
- "tenant-level gaps": "Signer gaps in the range that concern every tenant, such as witness failures.",
2519
- "log tail": "Whether records after the checkpoint are proven absent (a log.closed) or simply unproven.",
2520
- "rekor anchor": "A Rekor transparency-log anchor of the checkpoint, which this page can't check.",
2521
- "SLH-DSA-SHA2-128s checkpoint signature": "A post-quantum checkpoint signature, which browsers can't check yet.",
2522
- "record-key certificates": "Certificates of the record keys, which this page doesn't check.",
2523
- "tracekit why findings": "tracekit why investigation findings, which this page doesn't check.",
2612
+ "trust config": {
2613
+ warn: "You chose no trust file, so no log key you trust checked the checkpoint: the bundle can't be VERIFIED.",
2614
+ fail: "Your trust file (the log key and witnesses you trust) can't be used, for the reason on this line, so nothing "
2615
+ + "in the bundle was checked.",
2616
+ },
2617
+ "bundle readable": { fail: "This verifier can't read the file as a Tracekit v2 bundle: it isn't one, is damaged, or "
2618
+ + "needs a newer verifier. Nothing in it was checked." },
2619
+ "bundle structure": { fail: "The bundle is malformed in a way no other line covers, so it couldn't be fully "
2620
+ + "checked." },
2621
+ "manifest": {
2622
+ pass: "The files in the bundle are exactly those its manifest lists, with those hashes.",
2623
+ fail: "A file was added, removed or changed after the bundle was exported: the files don't match its manifest.",
2624
+ },
2625
+ "checkpoint": {
2626
+ pass: "The log's checkpoint (the signed root of every record) matches the proofs and is signed by the log key "
2627
+ + "your trust file pins; without a trust file its signature isn't checked.",
2628
+ fail: "The checkpoint isn't signed by the log key your trust file pins, or it was changed: the bundle comes from "
2629
+ + "another signer, or was edited.",
2630
+ },
2631
+ "witness quorum": {
2632
+ pass: "Enough witnesses your trust file pins cosigned the checkpoint: they vouch it was not rolled back.",
2633
+ fail: "Fewer witnesses your trust file pins cosigned the checkpoint than it requires: not enough vouch it was not "
2634
+ + "rolled back.",
2635
+ },
2636
+ "keys": {
2637
+ pass: "The record keys were declared by records the checkpoint includes, in order, and retired keys stop signing.",
2638
+ fail: "A key record is missing from the checkpointed tree, out of order, or retires a key never declared: the "
2639
+ + "record keys can't be trusted.",
2640
+ warn: "Nothing proves the bundle shows every key retirement: one left out would not show. It doesn't mean one was.",
2641
+ },
2642
+ "run parts": {
2643
+ pass: "A long run comes in numbered parts: none is missing between the first and the last, extra or out of "
2644
+ + "order, so they read as one run. Parts cut off its end leave it open, never VERIFIED.",
2645
+ fail: "A long run's parts don't read as one run: a part is missing, extra, empty or out of order.",
2646
+ },
2647
+ "signatures": {
2648
+ pass: "Every record's signature verifies under a key valid at its position: no record was edited after signing.",
2649
+ fail: "A record doesn't verify: it was edited after signing, or signed by a key not valid at its position.",
2650
+ },
2651
+ "run chain": {
2652
+ pass: "Each run's records follow one another without a gap from the first: none deleted, swapped or added.",
2653
+ fail: "A run's records don't follow one another: one was deleted, swapped, copied from another run, or added "
2654
+ + "after the run ended.",
2655
+ },
2656
+ "inclusion": {
2657
+ pass: "Each run's first and last records are in the checkpointed tree: the run wasn't rebuilt.",
2658
+ fail: "A run's first or last record isn't in the checkpointed tree: the run was rebuilt or cut short, or the "
2659
+ + "proofs are for another tree.",
2660
+ },
2661
+ "policy snapshot": {
2662
+ pass: "The bundled policy file is named by its own hash: it wasn't edited.",
2663
+ fail: "The bundled policy file doesn't match the hash it is named by: it was edited.",
2664
+ },
2665
+ "policy": { warn: "A tool call ran against a deny, or an ask nobody approved, and the signer recorded it." },
2666
+ "held calls": { warn: "A call held for a gateway or executor got no result before its run ended." },
2667
+ "gaps": { warn: "The signer recorded something a person should read: a gap, a tamper attempt or a mismatched "
2668
+ + "approval." },
2669
+ "external decisions": {
2670
+ pass: "Decisions imported from another policy system: none disagreed with the signer's.",
2671
+ warn: "A decision imported from another policy system disagreed with the signer's: the signer's is the one that "
2672
+ + "applied.",
2673
+ },
2674
+ "coverage": {
2675
+ pass: "Which capture layers reported; the signer matched every call across them. The record is only as complete "
2676
+ + "as those layers.",
2677
+ warn: "The signer couldn't match some calls across capture layers, or saw a host no call explains. It doesn't "
2678
+ + "mean the agent hid a call: a layer may simply not have reported.",
2679
+ },
2680
+ "coverage matrix": { pass: "How each kind of action was covered: enforced, observed, only reported by the agent, or "
2681
+ + "not at all." },
2682
+ "observers": { warn: "An observer outside the agent went silent or restarted while the run was open." },
2683
+ "reviews": {
2684
+ pass: "Reviews of the run, each labelled by who wrote it; every signed finding cites records the run has.",
2685
+ warn: "A signed finding is self-asserted: the agent could have written it about itself.",
2686
+ fail: "A signed finding cites a record the run doesn't have or that has another hash, or isn't shaped as a "
2687
+ + "signer writes one: it misstates the evidence.",
2688
+ },
2689
+ "reviews counted": { warn: "Findings whose analysed run isn't in the bundle, so their citations weren't checked." },
2690
+ "incidents": {
2691
+ pass: "Detections the signer opened, recomputed from the run's records where the bundle allows.",
2692
+ fail: "An incident doesn't follow from the run's records, or the records don't honour a hold or quarantine it "
2693
+ + "recorded.",
2694
+ },
2695
+ "incident policies": { warn: "Policies an incident cites that aren't in the bundle: those incidents are the "
2696
+ + "signer's word." },
2697
+ "content vault": { pass: "Who read or erased retained content, as the signer recorded it." },
2698
+ "tiers": {
2699
+ pass: "Tool calls by how they were captured: T2 gateway or executor, T1 adapter, T3 import (receipt only).",
2700
+ warn: "A tool call was decided and completed by different capture paths, so it counts at the weaker tier.",
2701
+ },
2702
+ "args source": { pass: "Whether recorded arguments are the model's exact bytes (raw), parsed, or changed by a "
2703
+ + "framework." },
2704
+ "isolation": { pass: "How the signer measured its separation from the agent: separate-user and remote are out of "
2705
+ + "its reach." },
2706
+ "principals": { pass: "The person or service each run acted for, attested by the signer or asserted by the app." },
2707
+ "harness": { pass: "The agent harness the signer bound each run to." },
2708
+ "fail-open classes": {
2709
+ pass: "No tool class runs while the signer is down: every call needed the signer.",
2710
+ warn: "Tool classes allowed to run while the signer is down, so such calls may be unrecorded.",
2711
+ },
2712
+ "key assurance": { pass: "Whether the record keys are only declared by the log (asserted) or certified by an "
2713
+ + "issuer." },
2714
+ "approvals by people": { pass: "Held calls approved by people." },
2715
+ "approvals by agents": {
2716
+ pass: "Held calls approved by agents (model output), checked against the rules that allow it.",
2717
+ warn: "Held calls approved by agents (model output); some couldn't be checked against their rules: the bundle "
2718
+ + "lacks the policy they were held under.",
2719
+ fail: "An agent approved a call the rules for agent approvals don't let it approve.",
2720
+ },
2721
+ "break-glass approvals": { warn: "Approvals given under the break-glass role, with who and why." },
2722
+ "not interpreted": { warn: "Records carry an extension this verifier doesn't read. They verified like every other "
2723
+ + "record." },
2724
+ "gateway amendments": {
2725
+ pass: "Requests the LLM gateway changed so the provider shows its reasoning; each record commits to the request "
2726
+ + "as sent.",
2727
+ warn: "A record carries a gateway amendment where or how the signer never writes one. The record verified like "
2728
+ + "every other.",
2729
+ },
2730
+ "openshell policy": {
2731
+ pass: "Changes of the sandbox's policy or configuration that NVIDIA OpenShell reported, signed into the run as "
2732
+ + "OpenShell's report.",
2733
+ warn: "A record carries an OpenShell policy change where or how the signer never writes one. The record verified "
2734
+ + "like every other.",
2735
+ },
2736
+ "constraints": {
2737
+ pass: "What the person's request said not to do, added while the run was open, and the calls it held.",
2738
+ fail: "A call held by a live constraint comes before any constraint in its run, or wasn't held for approval: the "
2739
+ + "signer never writes either.",
2740
+ },
2741
+ "run-set": {
2742
+ pass: "Every run of the tenant in the registry range is in the bundle (COMPLETE).",
2743
+ fail: "A run of the tenant in the registry range is missing or cut short, or the bundle holds one that doesn't "
2744
+ + "belong (INCOMPLETE).",
2745
+ },
2746
+ "tenant-level gaps": { warn: "Signer gaps in the range that concern every tenant, such as witness failures." },
2747
+ "log tail": {
2748
+ pass: "No records follow the checkpoint: a log.closed proves it is the log's last.",
2749
+ warn: "Nothing proves no records follow the checkpoint (no log.closed). It doesn't mean any were hidden.",
2750
+ },
2751
+ "rekor anchor": { warn: "A Rekor transparency-log anchor of the checkpoint, which this page can't check." },
2752
+ "SLH-DSA-SHA2-128s checkpoint signature": { warn: "A post-quantum checkpoint signature, which browsers can't check "
2753
+ + "yet." },
2754
+ "record-key certificates": { warn: "Certificates of the record keys, which this page doesn't check." },
2755
+ "tracekit why findings": { warn: "tracekit why investigation findings, which this page doesn't check." },
2524
2756
  };
2525
2757
  const day = (ts) => ts.slice(0, 19).replace("T", " ") + " UTC";
2526
2758
  /** A few plain facts about the bundle's runs, from their records ({name: bytes}, the runs/ files, a run's parts read as
@@ -2539,11 +2771,13 @@ function summarize(files, rep) {
2539
2771
  const cp = rep.checks.find((c) => c.check === "checkpoint")?.detail.split(" at tree size")[0];
2540
2772
  if (cp)
2541
2773
  out.push(["Signer", `log ${cp}` + (anchored(rep) ? ", the key your trust file pins" : ", not checked (no trust file)")]);
2542
- const level = rep.assurance.split(";")[0];
2774
+ const level = rep.assurance.split(";")[0], self = rep.assurance.includes("; approvals: self");
2775
+ const unwitnessed = "no independent witness vouches for the checkpoint";
2543
2776
  out.push(["Assurance", level === "witnessed" ? "witnessed: independent witnesses cosigned the checkpoint"
2544
2777
  : level === "local" ? "local: only witnesses the log's operator runs cosigned the checkpoint"
2545
- : level === "dev" ? "dev: no independent witness vouches for the checkpoint (or a run holds a self-approval)"
2546
- : level]);
2778
+ : level === "dev" && self ? "dev: a run holds a self-approval (whoever asked for the call approved it)"
2779
+ + (rep.assurance.includes("; no witness cosignature") ? `, and ${unwitnessed}` : "")
2780
+ : level === "dev" ? `dev: ${unwitnessed}` : level]);
2547
2781
  const agents = runs.map((rs) => rs[0]).filter((e) => e?.type === "run.registered").map((e) => {
2548
2782
  const id = e.data?.identity;
2549
2783
  return `${JSON.stringify(String(e.data?.agent?.name ?? "agent"))}` + (id ? ` (${id.scheme}:${id.subject})` : "");
@@ -2555,11 +2789,13 @@ function summarize(files, rep) {
2555
2789
  out.push(["Tool calls", `${decisions.length} decided` + (decisions.length ? ": " + ["allow", "deny", "ask"]
2556
2790
  .map((d) => `${decisions.filter((x) => x === d).length} ${d}`).join(", ") : "")]);
2557
2791
  const answers = new Map(of("approval").map((e) => [e.data?.approval_id, e.data]));
2792
+ const expired = new Set(of("approval.expired").map((e) => e.data?.approval_id));
2558
2793
  const held = of("approval.request").map((e) => {
2559
2794
  const a = answers.get(e.data?.approval_id);
2560
2795
  const who = a ? `${a.decision === "approve" ? "approved" : a.decision === "reject" ? "rejected" : a.decision} by `
2561
2796
  + `${a.person ?? a.approver}` + (a.approver_kind === "agent" ? " (an agent)" : "")
2562
- + (a.self_approved ? " (self-approved)" : "") + (a.break_glass ? " (break-glass)" : "") : "no answer recorded";
2797
+ + (a.self_approved ? " (self-approved)" : "") + (a.break_glass ? " (break-glass)" : "")
2798
+ : expired.has(e.data?.approval_id) ? "expired before anyone answered" : "no answer recorded";
2563
2799
  const tool = e.data?.binding?.tool ?? e.tool_call_id;
2564
2800
  return `${tool == null ? "a call" : JSON.stringify(String(tool))}: ${who}`;
2565
2801
  });
@@ -2587,7 +2823,7 @@ const __web = (() => {
2587
2823
  * large bundle doesn't freeze the page; in the page itself where the browser refuses the worker.
2588
2824
  */
2589
2825
  const { MEANING: MEANING, asJson: asJson, asText: asText, cliExit: cliExit, nextSteps: nextSteps, sh: sh, summarize: summarize, verdict: verdict } = __explain;
2590
- const { VERSION: VERSION, clean: clean, readZip: readZip, verify: verify } = __index;
2826
+ const { VERSION: VERSION, assuranceLine: assuranceLine, clean: clean, readZip: readZip, verify: verify } = __index;
2591
2827
  /** The report, and a summary of the runs when nothing failed (what a failed bundle says can't be relied on). */
2592
2828
  async function work(job) {
2593
2829
  const { report, code } = await verify(job.bundle, job.trust, job.names);
@@ -2701,7 +2937,7 @@ function page() {
2701
2937
  return; // a later choice of files: its report wins
2702
2938
  const { report, code, summary } = result;
2703
2939
  const v = verdict(report, code);
2704
- $("banner").className = `banner ${{ VERIFIED: "ok", FAILED: "bad", UNVERIFIABLE: "warn" }[v.word]}`;
2940
+ $("banner").className = `banner ${{ VERIFIED: "ok", FAILED: "bad", UNVERIFIABLE: "warn", "UNUSABLE BUNDLE": "warn" }[v.word]}`;
2705
2941
  $("verdict-word").textContent = v.word;
2706
2942
  $("verdict-means").textContent = v.means;
2707
2943
  $("verdict-not").textContent = v.notMeans;
@@ -2725,12 +2961,12 @@ function page() {
2725
2961
  d.append(s);
2726
2962
  for (const p of c.problems)
2727
2963
  d.append(el("div", clean(p), "problem")); // one by one: a spread overflows the stack
2728
- d.append(el("p", `What this means: ${MEANING[c.check] ?? "see docs/verdicts.md."}`, "means"));
2964
+ d.append(el("p", `What this means: ${MEANING[c.check]?.[c.status] ?? "see docs/verdicts.md."}`, "means"));
2729
2965
  d.open = c.status !== "pass" && c.problems.length > 0;
2730
2966
  return d;
2731
2967
  }));
2732
2968
  $("integrity").textContent = `Integrity: ${clean(report.integrity)}.`;
2733
- $("assurance").textContent = `Assurance: ${clean(report.assurance)}.`;
2969
+ $("assurance").textContent = assuranceLine(report);
2734
2970
  last = { text: asText(report, code), json: JSON.stringify(asJson(report, code), null, 2) + "\n", name: bundle.name };
2735
2971
  $("exit").textContent = last.text.trim().split("\n").at(-1) + cliExit(report);
2736
2972
  $("report").textContent = last.text;