Repository navigation
Commit 1b766ab
feat(attest): verify --report and --require-bound (#263)
Closes two follow-ups from #247.
## Problem
`attest verify` checks that the seal's three stored digests chain
together, and that `decision_hash` equals `report_hash`. Both of those
values are stored inside the sidecar. **Nothing rehashed the report
itself**, so a report edited after sealing still verified:
```
$ attest verify r.attestation.json # r.json edited after sealing
[OK] Attestation verified
```
Legacy seals (no `hash_scheme`) also verify without binding their intent
and evidence, and there was no way to require binding.
## Change
- **`--report <REPORT>`** rehashes the report file and fails with
`report_hash mismatch: stored=… computed=…` if the hashes differ.
- **`--require-bound`** fails on legacy seals with `legacy hash scheme:
intent and evidence are not bound to the seal`.
- The output now has a `Report:` line: `rehashed, matches the seal` or
`not checked (pass --report)`.
- **Library:**
- `VerifyOptions { report, require_bound }`, used with new
`verify_attestation_file_with` / `verify_attestation_str_with`.
- The existing `verify_attestation_file` / `verify_attestation_str` keep
their behaviour; they call the new functions with default options.
- `VerifyResult::Ok` gains `report_checked`, so a caller can't mistake
an unchecked report for a verified one.
## Validation
- **New tests:**
- `the_sealed_report_verifies`: `report_checked` is true with `--report`
and false without it.
- `an_edited_report_is_detected`
- `require_bound_rejects_legacy_seals_only`: a genuine legacy seal
fails, a JCS seal passes.
- **End to end with the built CLI** (`assail examples --attest`):
- The genuine report verifies (`Report: rehashed, matches the seal`).
- A report edited after sealing fails with `report_hash mismatch`; the
same file without `--report` still says `[OK]`, which is the gap this
closes.
- A legacy sidecar, rebuilt with `jq` plus a `sha256sum` chain hash,
passes by default and fails with `--require-bound`.
- A missing report file gives a clear `reading …: No such file or
directory`.
- `cargo fmt --check`, plus `cargo clippy --locked --all-targets -D
warnings` with and without `--all-features`: clean.
- `cargo test --locked --all-features`: all suites green (lib: 526
passed).
This touches `CHANGELOG.adoc` like the other open PRs (#261, #262).
Whichever merges later needs a trivial merge of main, and I'll handle
it.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01PFaqv6iBXrt3W5Akd1Fq5k)_
---------
Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>1 parent 41966b7 commit 1b766ab
3 files changed
Lines changed: 212 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
63 | 98 | | |
64 | 99 | | |
65 | 100 | | |
| |||
72 | 107 | | |
73 | 108 | | |
74 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
75 | 118 | | |
76 | 119 | | |
77 | 120 | | |
| |||
87 | 130 | | |
88 | 131 | | |
89 | 132 | | |
90 | | - | |
| 133 | + | |
91 | 134 | | |
92 | 135 | | |
93 | 136 | | |
94 | 137 | | |
95 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
96 | 147 | | |
97 | 148 | | |
98 | 149 | | |
| |||
165 | 216 | | |
166 | 217 | | |
167 | 218 | | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
168 | 238 | | |
169 | 239 | | |
170 | 240 | | |
| |||
185 | 255 | | |
186 | 256 | | |
187 | 257 | | |
| 258 | + | |
188 | 259 | | |
189 | 260 | | |
190 | 261 | | |
| |||
270 | 341 | | |
271 | 342 | | |
272 | 343 | | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
273 | 349 | | |
274 | 350 | | |
275 | 351 | | |
| |||
280 | 356 | | |
281 | 357 | | |
282 | 358 | | |
283 | | - | |
| 359 | + | |
| 360 | + | |
284 | 361 | | |
285 | 362 | | |
286 | 363 | | |
| |||
445 | 522 | | |
446 | 523 | | |
447 | 524 | | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
448 | 611 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
982 | 982 | | |
983 | 983 | | |
984 | 984 | | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
985 | 994 | | |
986 | 995 | | |
987 | 996 | | |
| |||
2681 | 2690 | | |
2682 | 2691 | | |
2683 | 2692 | | |
2684 | | - | |
2685 | | - | |
| 2693 | + | |
| 2694 | + | |
| 2695 | + | |
| 2696 | + | |
| 2697 | + | |
| 2698 | + | |
| 2699 | + | |
| 2700 | + | |
| 2701 | + | |
| 2702 | + | |
| 2703 | + | |
| 2704 | + | |
| 2705 | + | |
| 2706 | + | |
| 2707 | + | |
| 2708 | + | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
2686 | 2713 | | |
2687 | 2714 | | |
2688 | 2715 | | |
2689 | 2716 | | |
2690 | 2717 | | |
| 2718 | + | |
2691 | 2719 | | |
2692 | 2720 | | |
2693 | 2721 | | |
| |||
2699 | 2727 | | |
2700 | 2728 | | |
2701 | 2729 | | |
| 2730 | + | |
| 2731 | + | |
| 2732 | + | |
| 2733 | + | |
| 2734 | + | |
2702 | 2735 | | |
2703 | 2736 | | |
2704 | 2737 | | |
| |||
0 commit comments