chadtmiller.com/group-host
atmosphere group host
atproto: space tokens, credentials and signed requests
MergedThis adds atproto::space_auth: delegation tokens, space credentials and client attestations (create, parse, verify), plus sign_request and verify_request for HTTP message signatures. It also adds PublicKey::verify_either_s. I read the whole diff and found nothing that needs changing. Checks pass, including the 100% coverage gate, fmt and clippy. The docs page is updated.
I checked these points:
verifyruns the time, audience and subject checks before the signature check, and the algorithm must match the key's curve.parserejects a credential whose lifetime exceeds an hour or is not positive, and one whoseiatis in the future.verify_requestsigns and verifies over the raw signature-params text it received, so there is no re-serialisation mismatch.verify_either_sis used only for the HTTP signature. Every other signature stays low-S only.
One optional note. The member scanner toggles quoted on every " and does not handle \" escapes. A header with an escaped quote could split in the wrong place. That can only make a valid request fail to verify, not make a bad one pass, and the PR already names the parser's limits, so I'd leave it.
What changes
atproto::space_auth: who may read a space, as the space alpha says (@atproto/space'scredential.tsandhttp-signature.ts):create), read for shape (parse) and checked (verify, its time given): a delegation token, a member's PDS vouching for a minute and once that its account asks; a space credential, the authority granting access for up to an hour, bound to a key of the member's (cnf.kid); a client attestation, an app vouching for itself. Each kind'styp,kid, audience, binding and lifetime are held as the reference holds them, and each refusal carries its code (BadJwt,BadJwtType,JwtExpired,BadJwtSignature, …), with 5 seconds of clock skew.sign_requestmakes the four headers of a request made with a credential, an HTTP message signature over the credential and its audience;verify_requestchecks one against the credential's key, holding what it covers, its tag, algorithm and keyid as the reference does, and passing over other members of the headers' dictionaries.PublicKey::verify_either_s: such a signature may be high-S, as the alpha's check allows; every other signature here stays low-S only.Why
Step 4: the host is the authority for its groups' spaces, so it checks the delegation tokens members' PDSes send, grants space credentials, and checks each signed request made with one. Next: the repos the host keeps in spaces.
How it was checked
The reference's signed request (
space-vectors.json'shttpSignature) verifies, and refuses once its audience changes. Requests knotless's client signs (knotless::space::signed, 20 of them, in a scratch crate linking both) verify. Each token kind made and checked; each refusal of making and of checking, by code; the signed request's every malformed form. The interop vectors' high-S signatures are refused byverifyand taken byverify_either_s.cargo llvm-covat 100% of lines and functions, clippy clean.Shortcomings
A token's single use (the jti spent once) is the caller's to keep, as in the reference. The structured-field parsing is enough for these headers, not a general one.