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:741–766  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

739
740 #[test]
741 fn tampered_same_signer_is_x() {
742 // A fresh attestation whose stored body was mutated after signing, with a
743 // DID that MATCHES the resolving key ⇒ DID-match passes, verify() returns
744 // a hash mismatch ⇒ '✗'. Distinguishes ✗ (real failure) from '–'.
745 let (repo, ids, _dir) = repo_with_intents(1);
746 let kp = KeyPair::generate();
747 let mut node = attest_with(&repo, &ids[0], &kp);
748 write_tracked(&repo, &ids[0], &node);
749 // Confirm untampered verifies.
750 assert_eq!(row_for(&repo, &ids[0], Some(&kp)).verifies, Verifies::Yes);
751
752 // Tamper a signed field (the title/text) AFTER signing but keep the same
753 // attributedTo DID and the same recorded sourceContentHash (so it stays
754 // Fresh). The content hash / signature no longer match the body.
755 node.title = "tampered title".to_string();
756 write_tracked(&repo, &ids[0], &node);
757
758 let row = row_for(&repo, &ids[0], Some(&kp));
759 assert_eq!(
760 row.attested,
761 Attested::Fresh,
762 "still fresh (hash anchor kept)"
763 );
764 assert_eq!(row.verifies, Verifies::No, "tampered same-signer ⇒ '✗'");
765 assert_eq!(row.verifies.table(), "✗");
766 }
767
768 #[test]
769 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