Commit 647f140
fix(claude-code): sign the TRACE record with the persisted key, not a fresh one (#180)
sign_all called agentrust_trace.generate_key() per record, so the private half
was discarded immediately and the only copy of the public half was the cnf.jwk
inside the record itself. agentrust_trace.verify_record refuses that by
default:
ValueError: verify_record requires a trusted key. Pass an Ed25519PublicKey
or JWK dict, or set allow_embedded_key=True to (insecurely) trust the key
embedded in record.cnf.jwk.
and with the flag on it warns that this "proves the record is internally
consistent, NOT that it came from a trusted issuer". So the signature on a
per-session signed Trust Record attested to nothing about its origin, which is
the property the record exists to carry. Anyone can generate a key, sign a
record and embed the public half.
It also gave the agent a new TRACE identity every session. Three records
captured on this machine in August carry three different cnf.jwk keys
(EQRU0ZFB..., tjOZOANU..., FJscFYnI...) while their manifests all share key
92d6daa1.... An identity that changes per session cannot be pinned out of band
and cannot be registered as a trace-registry producer, because the registry
looks a producer key up from producers/ rather than trusting the key a claim
names for itself.
The record now uses the keypair the manifest already uses, persisted at
~/.claude/agentrust/signing_key.json, whose public half is published beside
every record as verification_key.json. Third parties verify both files with
that one key, and the note in it says so.
Records emitted before this change cannot be retrofitted; their signing keys
are gone.
The test suite asserted the manifest was externally verifiable and never asked
the same of the record, which is why this survived three sessions. Two tests
now mirror that assertion: the record verifies under the published key with no
allow_embedded_key, refuses a different key, and the manifest and record share
one key across two runs. Both fail against the previous behaviour, checked by
reverting. 61 pass.
Claude-Session: https://claude.ai/code/session_01X2GDChXjA7BAdDNzCAmBJv
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 30fef35 commit 647f140
3 files changed
Lines changed: 105 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
7 | 33 | | |
8 | 34 | | |
9 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
451 | 451 | | |
452 | 452 | | |
453 | 453 | | |
454 | | - | |
| 454 | + | |
455 | 455 | | |
456 | 456 | | |
457 | 457 | | |
| |||
467 | 467 | | |
468 | 468 | | |
469 | 469 | | |
470 | | - | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
471 | 478 | | |
472 | 479 | | |
473 | 480 | | |
474 | 481 | | |
475 | | - | |
476 | | - | |
477 | | - | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
478 | 486 | | |
479 | 487 | | |
480 | 488 | | |
481 | 489 | | |
482 | | - | |
| 490 | + | |
| 491 | + | |
483 | 492 | | |
484 | 493 | | |
485 | 494 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
543 | 544 | | |
544 | 545 | | |
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 | + | |
546 | 610 | | |
547 | 611 | | |
548 | 612 | | |
| |||
0 commit comments