@sanning/proof 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -12
- package/dist/agent-proof.d.ts +2 -2
- package/dist/agent-proof.js +4 -4
- package/dist/case-file.d.ts +126 -0
- package/dist/case-file.js +353 -0
- package/dist/case.d.ts +217 -26
- package/dist/case.js +535 -124
- package/dist/cli.d.ts +64 -8
- package/dist/cli.js +799 -219
- package/dist/compose.js +6 -1
- package/dist/crypto.d.ts +1 -1
- package/dist/crypto.js +5 -1
- package/dist/declaration.d.ts +58 -52
- package/dist/declaration.js +256 -33
- package/dist/evidence.d.ts +38 -0
- package/dist/evidence.js +238 -22
- package/dist/exit-codes.d.ts +17 -0
- package/dist/exit-codes.js +50 -0
- package/dist/file-match.d.ts +105 -0
- package/dist/file-match.js +374 -0
- package/dist/grading.d.ts +28 -13
- package/dist/grading.js +90 -31
- package/dist/index.d.ts +14 -7
- package/dist/index.js +20 -6
- package/dist/message-parts.d.ts +18 -10
- package/dist/message-parts.js +25 -15
- package/dist/types.d.ts +1 -0
- package/dist/verifier.d.ts +63 -4
- package/dist/verifier.js +223 -15
- package/dist/witness-cache.d.ts +85 -0
- package/dist/witness-cache.js +264 -0
- package/dist/zip-reader.d.ts +50 -0
- package/dist/zip-reader.js +220 -0
- package/package.json +2 -2
- package/src/agent-proof.ts +4 -4
- package/src/case-file.ts +422 -0
- package/src/case.ts +671 -131
- package/src/cli.ts +932 -217
- package/src/compose.ts +8 -1
- package/src/crypto.ts +5 -1
- package/src/declaration.ts +248 -52
- package/src/evidence.ts +257 -23
- package/src/exit-codes.ts +54 -0
- package/src/file-match.ts +461 -0
- package/src/grading.ts +109 -52
- package/src/index.ts +101 -2
- package/src/message-parts.ts +25 -15
- package/src/types.ts +5 -0
- package/src/verifier.ts +225 -16
- package/src/witness-cache.ts +306 -0
- package/src/zip-reader.ts +229 -0
- package/vectors/README.md +66 -8
- package/vectors/case-file-index.json +668 -0
- package/vectors/case-split.json +218 -9
- package/vectors/file-match.json +1808 -0
- package/vectors/jcs-reader.json +82 -3
- package/vectors/pack-grading.json +68 -4
- package/vectors/stamp-on-chain.json +20 -5
- package/vectors/witness-cache.json +1304 -0
package/vectors/case-split.json
CHANGED
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
"description": "Packs zipped inside the folder and nothing else. No bundle.json at any path, so the folder is refused, and the hint says to unzip first.",
|
|
209
209
|
"expected": {
|
|
210
210
|
"error": "No bundle.json found. An evidence pack contains bundle.json plus logs/.",
|
|
211
|
-
"hint": "It holds 2 .zip file(s) (decision-file/evidence/packs/checker.zip, …), and case never opens a .zip.
|
|
211
|
+
"hint": "It holds 2 .zip file(s) (decision-file/evidence/packs/checker.zip, …), and case never opens a .zip inside a folder. Pass the .zip itself, or unzip it first (for example, unzip file.zip -d case/) and pass the folder."
|
|
212
212
|
},
|
|
213
213
|
"id": "zipped-packs-only",
|
|
214
214
|
"tree": [
|
|
@@ -230,15 +230,25 @@
|
|
|
230
230
|
"args": [
|
|
231
231
|
"pack.zip"
|
|
232
232
|
],
|
|
233
|
-
"description": "A .zip named on the command line is
|
|
233
|
+
"description": "A .zip named on the command line is read as a case file (evidence-bundle §5.6, v1.20 A25): <name>.zip is read at <name>/<entry>, the folder unzip <name>.zip -d <name> makes, so the archive and its unpacked folder give one reading.",
|
|
234
234
|
"expected": {
|
|
235
|
-
"
|
|
236
|
-
"
|
|
235
|
+
"not_regular": [],
|
|
236
|
+
"outside": [],
|
|
237
|
+
"packs": [
|
|
238
|
+
{
|
|
239
|
+
"bundle_path": "pack/bundle.json",
|
|
240
|
+
"content": {
|
|
241
|
+
"x": "78"
|
|
242
|
+
},
|
|
243
|
+
"ref": "pack",
|
|
244
|
+
"unaccounted": []
|
|
245
|
+
}
|
|
246
|
+
]
|
|
237
247
|
},
|
|
238
|
-
"id": "zip-argument-
|
|
248
|
+
"id": "zip-argument-read",
|
|
239
249
|
"tree": [
|
|
240
250
|
{
|
|
241
|
-
"hex": "
|
|
251
|
+
"hex": "504b03041400000008000000375d408bd69528000000260000000b00000062756e646c652e6a736f6eab562a2e484d8e2f4b2d2acecccf53b2522a4ecccbcbcc4bd74b2dcb4c49cd4b4ed52f3354aa0500504b03041400000008000000375d8316dc8c03000000010000000b0000006c6f67732f782e6a736f6eab0000504b010214031400000008000000375d408bd69528000000260000000b000000000000000000000080010000000062756e646c652e6a736f6e504b010214031400000008000000375d8316dc8c03000000010000000b00000000000000000000008001510000006c6f67732f782e6a736f6e504b05060000000002000200720000007d0000000000",
|
|
242
252
|
"path": "pack.zip"
|
|
243
253
|
}
|
|
244
254
|
]
|
|
@@ -247,9 +257,9 @@
|
|
|
247
257
|
"args": [
|
|
248
258
|
"PACK.Zip"
|
|
249
259
|
],
|
|
250
|
-
"description": "The extension is matched without regard to ASCII case.",
|
|
260
|
+
"description": "The extension is matched without regard to ASCII case, and bytes that are not a .zip archive refuse the input.",
|
|
251
261
|
"expected": {
|
|
252
|
-
"error": "<root>/PACK.Zip is a .zip archive
|
|
262
|
+
"error": "<root>/PACK.Zip is not a readable .zip archive",
|
|
253
263
|
"hint": null
|
|
254
264
|
},
|
|
255
265
|
"id": "zip-argument-any-case",
|
|
@@ -266,7 +276,7 @@
|
|
|
266
276
|
],
|
|
267
277
|
"description": "A file that is not a .zip is not a folder either.",
|
|
268
278
|
"expected": {
|
|
269
|
-
"error": "<root>/bundle.json is not a folder. Pass pack folders,
|
|
279
|
+
"error": "<root>/bundle.json is not a folder or a .zip. Pass pack folders, the folder that holds them, or a case file.",
|
|
270
280
|
"hint": null
|
|
271
281
|
},
|
|
272
282
|
"id": "file-argument-refused",
|
|
@@ -277,6 +287,205 @@
|
|
|
277
287
|
}
|
|
278
288
|
]
|
|
279
289
|
},
|
|
290
|
+
{
|
|
291
|
+
"args": [
|
|
292
|
+
"case-4b19de"
|
|
293
|
+
],
|
|
294
|
+
"description": "A case file, unzipped: packs a and b under packs/<ref>/, and the index, the command and every report/ file outside every pack. The case file needs no new splitting rule. The zip under report/ is a file like any other and is never opened, although it holds a bundle.json.",
|
|
295
|
+
"expected": {
|
|
296
|
+
"not_regular": [],
|
|
297
|
+
"outside": [
|
|
298
|
+
"case-4b19de/HOW-TO-VERIFY.txt",
|
|
299
|
+
"case-4b19de/contents.json",
|
|
300
|
+
"case-4b19de/report/README.txt",
|
|
301
|
+
"case-4b19de/report/memo.pdf",
|
|
302
|
+
"case-4b19de/report/nested.zip"
|
|
303
|
+
],
|
|
304
|
+
"packs": [
|
|
305
|
+
{
|
|
306
|
+
"bundle_path": "case-4b19de/packs/a/bundle.json",
|
|
307
|
+
"content": {
|
|
308
|
+
"x": "78"
|
|
309
|
+
},
|
|
310
|
+
"ref": "case-4b19de/packs/a",
|
|
311
|
+
"unaccounted": []
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"bundle_path": "case-4b19de/packs/b/bundle.json",
|
|
315
|
+
"content": {},
|
|
316
|
+
"ref": "case-4b19de/packs/b",
|
|
317
|
+
"unaccounted": []
|
|
318
|
+
}
|
|
319
|
+
]
|
|
320
|
+
},
|
|
321
|
+
"id": "case-file-unpacked",
|
|
322
|
+
"tree": [
|
|
323
|
+
{
|
|
324
|
+
"hex": "7b22737065635f76657273696f6e223a2273616e6e696e672e65766964656e63652f7631227d",
|
|
325
|
+
"path": "case-4b19de/packs/a/bundle.json"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"hex": "78",
|
|
329
|
+
"path": "case-4b19de/packs/a/logs/x.json"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"hex": "7b22737065635f76657273696f6e223a2273616e6e696e672e65766964656e63652f7631227d",
|
|
333
|
+
"path": "case-4b19de/packs/b/bundle.json"
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"hex": "7b7d",
|
|
337
|
+
"path": "case-4b19de/contents.json"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"hex": "756e7a6970",
|
|
341
|
+
"path": "case-4b19de/HOW-TO-VERIFY.txt"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"hex": "4e6f742065766964656e6365",
|
|
345
|
+
"path": "case-4b19de/report/README.txt"
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
"hex": "25504446",
|
|
349
|
+
"path": "case-4b19de/report/memo.pdf"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"hex": "504b03041400000008000000375d408bd69528000000260000000b00000062756e646c652e6a736f6eab562a2e484d8e2f4b2d2acecccf53b2522a4ecccbcbcc4bd74b2dcb4c49cd4b4ed52f3354aa0500504b010214031400000008000000375d408bd69528000000260000000b000000000000000000000080010000000062756e646c652e6a736f6e504b0506000000000100010039000000510000000000",
|
|
353
|
+
"path": "case-4b19de/report/nested.zip"
|
|
354
|
+
}
|
|
355
|
+
]
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"args": [
|
|
359
|
+
"case-4b19de.zip"
|
|
360
|
+
],
|
|
361
|
+
"description": "The same case file named as case-4b19de.zip: the same split, key for key.",
|
|
362
|
+
"expected": {
|
|
363
|
+
"not_regular": [],
|
|
364
|
+
"outside": [
|
|
365
|
+
"case-4b19de/HOW-TO-VERIFY.txt",
|
|
366
|
+
"case-4b19de/contents.json",
|
|
367
|
+
"case-4b19de/report/README.txt",
|
|
368
|
+
"case-4b19de/report/memo.pdf",
|
|
369
|
+
"case-4b19de/report/nested.zip"
|
|
370
|
+
],
|
|
371
|
+
"packs": [
|
|
372
|
+
{
|
|
373
|
+
"bundle_path": "case-4b19de/packs/a/bundle.json",
|
|
374
|
+
"content": {
|
|
375
|
+
"x": "78"
|
|
376
|
+
},
|
|
377
|
+
"ref": "case-4b19de/packs/a",
|
|
378
|
+
"unaccounted": []
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
"bundle_path": "case-4b19de/packs/b/bundle.json",
|
|
382
|
+
"content": {},
|
|
383
|
+
"ref": "case-4b19de/packs/b",
|
|
384
|
+
"unaccounted": []
|
|
385
|
+
}
|
|
386
|
+
]
|
|
387
|
+
},
|
|
388
|
+
"id": "case-file-zip",
|
|
389
|
+
"tree": [
|
|
390
|
+
{
|
|
391
|
+
"hex": "504b03041400000008000000375d408bd6952800000026000000130000007061636b732f612f62756e646c652e6a736f6eab562a2e484d8e2f4b2d2acecccf53b2522a4ecccbcbcc4bd74b2dcb4c49cd4b4ed52f3354aa0500504b03041400000008000000375d8316dc8c0300000001000000130000007061636b732f612f6c6f67732f782e6a736f6eab0000504b03041400000008000000375d408bd6952800000026000000130000007061636b732f622f62756e646c652e6a736f6eab562a2e484d8e2f4b2d2acecccf53b2522a4ecccbcbcc4bd74b2dcb4c49cd4b4ed52f3354aa0500504b03041400000008000000375d43bfa6a304000000020000000d000000636f6e74656e74732e6a736f6eabae0500504b03041400000008000000375dc654b591070000000500000011000000484f572d544f2d5645524946592e7478742bcdabca2c0000504b03041400000008000000375d47efbb750e0000000c000000110000007265706f72742f524541444d452e747874f3cb2f51482dcb4c49cd4b4e0500504b03041400000008000000375d04c0bed106000000040000000f0000007265706f72742f6d656d6f2e706466530d70710300504b03041400000008000000375d88567fd66c000000a0000000110000007265706f72742f6e65737465642e7a69700bf0666611616060e00062f35887ee6b5335802c3520e606e2a4d2bc949c54bdace2fcbcd5615a7a1ebe7dfadeba5ae7ce9c0fde14a4e577e6f4e933ded7bd754ffb789ef5f6bbaa6f1cb28a9521c09b91498419b79130d0c0c8806a4180372b1b488811082d817420581900504b010214031400000008000000375d408bd69528000000260000001300000000000000000000008001000000007061636b732f612f62756e646c652e6a736f6e504b010214031400000008000000375d8316dc8c03000000010000001300000000000000000000008001590000007061636b732f612f6c6f67732f782e6a736f6e504b010214031400000008000000375d408bd695280000002600000013000000000000000000000080018d0000007061636b732f622f62756e646c652e6a736f6e504b010214031400000008000000375d43bfa6a304000000020000000d00000000000000000000008001e6000000636f6e74656e74732e6a736f6e504b010214031400000008000000375dc654b5910700000005000000110000000000000000000000800115010000484f572d544f2d5645524946592e747874504b010214031400000008000000375d47efbb750e0000000c00000011000000000000000000000080014b0100007265706f72742f524541444d452e747874504b010214031400000008000000375d04c0bed106000000040000000f00000000000000000000008001880100007265706f72742f6d656d6f2e706466504b010214031400000008000000375d88567fd66c000000a00000001100000000000000000000008001bb0100007265706f72742f6e65737465642e7a6970504b05060000000008000800f8010000560200000000",
|
|
392
|
+
"path": "case-4b19de.zip"
|
|
393
|
+
}
|
|
394
|
+
]
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"args": [
|
|
398
|
+
"p.zip"
|
|
399
|
+
],
|
|
400
|
+
"description": "Entries a reader refuses are listed as outside every pack and never read, even under the pack's logs/: an absolute name, a .. segment, a backslash, a symbolic link, a compression method other than stored or deflate, and an encrypted entry. A stored entry is read.",
|
|
401
|
+
"expected": {
|
|
402
|
+
"not_regular": [
|
|
403
|
+
"p//abs.json",
|
|
404
|
+
"p/logs/../up.json",
|
|
405
|
+
"p/logs/bz.json",
|
|
406
|
+
"p/logs/enc.json",
|
|
407
|
+
"p/logs/link.json",
|
|
408
|
+
"p/logs\\back.json"
|
|
409
|
+
],
|
|
410
|
+
"outside": [
|
|
411
|
+
"p//abs.json",
|
|
412
|
+
"p/logs/../up.json",
|
|
413
|
+
"p/logs/bz.json",
|
|
414
|
+
"p/logs/enc.json",
|
|
415
|
+
"p/logs/link.json",
|
|
416
|
+
"p/logs\\back.json"
|
|
417
|
+
],
|
|
418
|
+
"packs": [
|
|
419
|
+
{
|
|
420
|
+
"bundle_path": "p/bundle.json",
|
|
421
|
+
"content": {
|
|
422
|
+
"ok": "6f6b",
|
|
423
|
+
"stored": "73"
|
|
424
|
+
},
|
|
425
|
+
"ref": "p",
|
|
426
|
+
"unaccounted": []
|
|
427
|
+
}
|
|
428
|
+
]
|
|
429
|
+
},
|
|
430
|
+
"id": "zip-entries-refused",
|
|
431
|
+
"tree": [
|
|
432
|
+
{
|
|
433
|
+
"hex": "504b03041400000008000000375d408bd69528000000260000000b00000062756e646c652e6a736f6eab562a2e484d8e2f4b2d2acecccf53b2522a4ecccbcbcc4bd74b2dcb4c49cd4b4ed52f3354aa0500504b03041400000008000000375d47dddc7904000000020000000c0000006c6f67732f6f6b2e6a736f6ecbcf0600504b03041400000008000000375d43beb7e80300000001000000090000002f6162732e6a736f6e4b0400504b03041400000008000000375d3e6a6df203000000010000000f0000006c6f67732f2e2e2f75702e6a736f6e2b0500504b03041400000008000000375df9efbe7103000000010000000e0000006c6f67735c6261636b2e6a736f6e4b0200504b03041400000008000000375dfc2f6f4608000000060000000e0000006c6f67732f6c696e6b2e6a736f6e2b492c4a4f2d0100504b03041400000000000000375d0bcf0e1b0100000001000000100000006c6f67732f73746f7265642e6a736f6e73504b03042e0000000c000000375daf77d26225000000010000000c0000006c6f67732f627a2e6a736f6e425a68393141592653597ec98b7a00000000800010200021184682ee48a70a120fd9316f40504b03041400010008000000375d5a7adaef03000000010000000d0000006c6f67732f656e632e6a736f6e4b0500504b010214031400000008000000375d408bd69528000000260000000b000000000000000000000080010000000062756e646c652e6a736f6e504b010214031400000008000000375d47dddc7904000000020000000c00000000000000000000008001510000006c6f67732f6f6b2e6a736f6e504b010214031400000008000000375d43beb7e8030000000100000009000000000000000000000080017f0000002f6162732e6a736f6e504b010214031400000008000000375d3e6a6df203000000010000000f00000000000000000000008001a90000006c6f67732f2e2e2f75702e6a736f6e504b010214031400000008000000375df9efbe7103000000010000000e00000000000000000000008001d90000006c6f67735c6261636b2e6a736f6e504b010214031400000008000000375dfc2f6f4608000000060000000e0000000000000000000000ffa1080100006c6f67732f6c696e6b2e6a736f6e504b010214031400000000000000375d0bcf0e1b010000000100000010000000000000000000000080013c0100006c6f67732f73746f7265642e6a736f6e504b01022e032e0000000c000000375daf77d26225000000010000000c000000000000000000000080016b0100006c6f67732f627a2e6a736f6e504b010214031400010008000000375d5a7adaef03000000010000000d00000000000000000000008001ba0100006c6f67732f656e632e6a736f6e504b0506000000000900090012020000e80100000000",
|
|
434
|
+
"path": "p.zip"
|
|
435
|
+
}
|
|
436
|
+
]
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
"args": [
|
|
440
|
+
"p.zip"
|
|
441
|
+
],
|
|
442
|
+
"description": "An entry whose bytes do not match the CRC-32 the archive records for them refuses the archive: which bytes are the file is not settled.",
|
|
443
|
+
"expected": {
|
|
444
|
+
"error": "<root>/p.zip holds bundle.json, which cannot be read",
|
|
445
|
+
"hint": null
|
|
446
|
+
},
|
|
447
|
+
"id": "zip-crc-mismatch",
|
|
448
|
+
"tree": [
|
|
449
|
+
{
|
|
450
|
+
"hex": "504b03041400000008000000215a418bd69528000000260000000b00000062756e646c652e6a736f6eab562a2e484d8e2f4b2d2acecccf53b2522a4ecccbcbcc4bd74b2dcb4c49cd4b4ed52f3354aa0500504b010214001400000008000000215a418bd69528000000260000000b000000000000000000000000000000000062756e646c652e6a736f6e504b0506000000000100010039000000510000000000",
|
|
451
|
+
"path": "p.zip"
|
|
452
|
+
}
|
|
453
|
+
]
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
"args": [
|
|
457
|
+
"p.zip"
|
|
458
|
+
],
|
|
459
|
+
"description": "Data after the end of an entry's deflate stream, inside the size the archive records, refuses the archive: one zip library reads past it and another stops, so the two kernels would read two files.",
|
|
460
|
+
"expected": {
|
|
461
|
+
"error": "<root>/p.zip holds bundle.json, which cannot be read",
|
|
462
|
+
"hint": null
|
|
463
|
+
},
|
|
464
|
+
"id": "zip-trailing-deflate-data",
|
|
465
|
+
"tree": [
|
|
466
|
+
{
|
|
467
|
+
"hex": "504b03041400000008000000215a408bd6952d000000260000000b00000062756e646c652e6a736f6eab562a2e484d8e2f4b2d2acecccf53b2522a4ecccbcbcc4bd74b2dcb4c49cd4b4ed52f3354aa0500006a756e6b504b010214001400000008000000215a408bd6952d000000260000000b000000000000000000000000000000000062756e646c652e6a736f6e504b0506000000000100010039000000560000000000",
|
|
468
|
+
"path": "p.zip"
|
|
469
|
+
}
|
|
470
|
+
]
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
"args": [
|
|
474
|
+
"p.zip"
|
|
475
|
+
],
|
|
476
|
+
"description": "An archive holding one name twice is refused whole: which of the two is the file is a choice two zip libraries make differently.",
|
|
477
|
+
"expected": {
|
|
478
|
+
"error": "<root>/p.zip holds bundle.json twice",
|
|
479
|
+
"hint": null
|
|
480
|
+
},
|
|
481
|
+
"id": "zip-name-twice",
|
|
482
|
+
"tree": [
|
|
483
|
+
{
|
|
484
|
+
"hex": "504b03041400000000000000375d408bd69526000000260000000b00000062756e646c652e6a736f6e7b22737065635f76657273696f6e223a2273616e6e696e672e65766964656e63652f7631227d504b03041400000000000000375d43bfa6a302000000020000000b00000062756e646c652e6a736f6e7b7d504b010214031400000000000000375d408bd69526000000260000000b000000000000000000000080010000000062756e646c652e6a736f6e504b010214031400000000000000375d43bfa6a302000000020000000b000000000000000000000080014f00000062756e646c652e6a736f6e504b05060000000002000200720000007a0000000000",
|
|
485
|
+
"path": "p.zip"
|
|
486
|
+
}
|
|
487
|
+
]
|
|
488
|
+
},
|
|
280
489
|
{
|
|
281
490
|
"args": [
|
|
282
491
|
"nope"
|