Refuse an AT-URI record stored outside the repository being verified

atproto-attestation-verify fetched a record given as an AT-URI but never compared the URI's repository with <repository_did>, the DID its attestations were checked against. A record copied from one repository into another, the replay the repository binding exists to stop, showed a check mark when given the repository it was copied from. The verifier now parses a record's AT-URI before anything is fetched and refuses the run, exiting 1, when its repository is not <repository_did>, with a message naming both DIDs. The DIDs are compared as written, as the signature binds them. A record given as a file, JSON or stdin is not checked: nothing else says where it lives. Refusing the run rather than marking each attestation with a cross: the mismatch is a fact about the arguments, not about any one attestation, so every line would carry the same reason, and the binary already refuses unusable arguments this way (a repository DID without did:, a proof record given as JSON, a bad PLC_HOSTNAME). Refusing before the fetch also means no network is needed to learn the two disagree. The exit rule is unchanged: 0 only when there is at least one attestation and all verified. A handle authority is refused with a message saying the tool resolves DIDs only, rather than resolved: the verifier deliberately does no DNS (it runs in scratch containers), and ATURI already refused a handle at the fetch, as an invalid AT-URI with no explanation. --help, the module docs, the Args docs, the README's CLI section and CLAUDE.md state the rule. The library has no such gap: verify_record and verify_signature take the record as JSON and the repository from the caller, and nothing in the crate takes a record's AT-URI. Tests: readme_cli.rs runs the verifier offline (PLC_HOSTNAME and HTTPS_PROXY on closed loopback ports, proxies cleared) and checks the README's rule: an AT-URI in another repository is refused naming both DIDs, before the record is loaded, with and without an attestation argument; one in the repository it names goes on to fetch; a handle authority is refused by name. verify_cli.rs's PLC_HOSTNAME test now passes the repository its AT-URI names, and shows that case reaches the directory. Ablation: with the check's call removed from main, both new readme_cli tests fail (the mismatched run fails at the fetch instead, so only the refusal message tells them apart), and pass again once it is restored. Refs: atproto-crates#zva1 (R2-ATT-8)


Author Nick Gerakines Date Commit Parent e73788d6
+205 -8
6 changed files
+205 -8
6 changed files