~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

Service auth is checked with atproto-client 0.7.1's verify_with

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:auth/verify-with

What changes

Service auth by verify_with. service_caller (the host's own methods, notifyRepoUpdate, notifyCredentialsRevoked) and the account-import token are checked with atproto-client 0.7.1's verify_with, which judges the audience itself, in place of reading the token's unverified audience and passing it to verify_any. service_caller's ours now takes the audience; its refusal (BadJwtAudience, Forbidden) is still the answer for an audience it does not take. An issuer that can't be resolved, or names no key, is BadJwtIss.

The import token answers as before 0.6. An account's token for moving here whose DID can't be resolved is InvalidRequest again (Error::Unresolved); one naming no key, or not signed by it, stays InvalidToken. The test changed for 0.6 expects InvalidRequest again.

Space credentials. Resolver::with_key now answers Result<Result<..>, identity::Error>: an unresolvable issuer is BadJwtIss, with why.

Why

0.6's verify_any could not tell an unresolvable issuer from one with no key, and took only a list of audiences, so the host pre-read unverified claims to build one. 0.7 adds both; 0.7.1 makes its futures Send.

How it was checked

cargo check was blocked locally by the registry's rate limit on the 0.7.1 download; build, tests and the gate are left to CI.

Approved

This moves service_caller and the import token's proof from verify_any to atproto-client 0.7.1's verify_with, and makes Resolver::with_key report an unresolvable issuer as BadJwtIss. I read every changed file and found nothing that needs changing.

  • service_caller: The ours closure is Fn(&str) now. Its refusal is kept in a Mutex and returned in place of the crate's generic error, so BadJwtAudience and Forbidden still come out as before. Unresolved and NoKey both become BadJwtIss.
  • proof: Dropping the pre-check of aud and lxm is fine. verify_with takes the audience predicate and CREATE_ACCOUNT, so a wrong audience or method is still refused InvalidToken. Only the message text differs. Unresolved is InvalidRequest again, and the test now expects that.
  • Space credentials: checked.map_err(no_key)?.map_err(refused)? matches the new nested result.
  • Change file and lockfile: The change file is present. Cargo.lock moves atproto to 0.4.4 and atproto-client to 0.7.1, and Cargo.toml asks for atproto-client 0.7.1.

The PR body says nothing was compiled locally. The check, test and e2e runs were still queued or running when I looked, so I haven't seen them pass. Please read check and test (fmt, clippy and the 100% coverage gate) before merging. The new Unresolved arm in proof and the (Some(refused), _) and BadJwtIss arms in service_caller each need a test that reaches them.

Merged as 184f600