MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / tampered_same_signer_is_x

Function tampered_same_signer_is_x

atomic-cli/src/commands/intent/list.rs:543–568  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

541
542 #[test]
543 fn tampered_same_signer_is_x() {
544 // A fresh attestation whose stored body was mutated after signing, with a
545 // DID that MATCHES the resolving key ⇒ DID-match passes, verify() returns
546 // a hash mismatch ⇒ '✗'. Distinguishes ✗ (real failure) from '–'.
547 let (repo, ids, _dir) = repo_with_intents(1);
548 let kp = KeyPair::generate();
549 let mut node = attest_with(&repo, &ids[0], &kp);
550 write_tracked(&repo, &ids[0], &node);
551 // Confirm untampered verifies.
552 assert_eq!(row_for(&repo, &ids[0], Some(&kp)).verifies, Verifies::Yes);
553
554 // Tamper a signed field (the title/text) AFTER signing but keep the same
555 // attributedTo DID and the same recorded sourceContentHash (so it stays
556 // Fresh). The content hash / signature no longer match the body.
557 node.title = "tampered title".to_string();
558 write_tracked(&repo, &ids[0], &node);
559
560 let row = row_for(&repo, &ids[0], Some(&kp));
561 assert_eq!(
562 row.attested,
563 Attested::Fresh,
564 "still fresh (hash anchor kept)"
565 );
566 assert_eq!(row.verifies, Verifies::No, "tampered same-signer ⇒ '✗'");
567 assert_eq!(row.verifies.table(), "✗");
568 }
569
570 #[test]
571 fn other_signer_is_na_not_x() {

Callers

nothing calls this directly

Calls 4

repo_with_intentsFunction · 0.85
attest_withFunction · 0.70
write_trackedFunction · 0.70
row_forFunction · 0.70

Tested by

no test coverage detected