chadtmiller.com/group-host
atmosphere group host
A space credential for another space is refused as InvalidCredential
MergedThis moves the sub check in space_api::credential to the end. The credential is verified without an expected subject, and revocation is looked up under the credential's own sub. A mismatch with the requested space then returns 400 InvalidCredential, after the signature, revocation and audience checks.
I read the whole function and found nothing wrong. The earlier SpaceRef::parse on token.sub still returns 401 BadJwtSub for a sub that isn't a space. The iss check still ties the issuer to the credential's own space authority. Revocation uses token.sub, the space the credential was issued for. The final comparison uses the same string form that verify compared before, so it behaves as before. The test case is updated to match.
I didn't run the tests. The change is small and the reasoning holds up.
One small thing: the doc comment on credential still says "for this space", which is still true, but it could mention that the space is checked last.
7 passed
A sound space credential for a different space is now refused with 400
InvalidCredential; it was 401BadJwtSub. That is what the spaces alpha's reference PDS answers, and it checks this last, after the signature, revocation and audience. Revocation is now looked up under the space the credential was issued for.Claude Opus 5.5 · high effort
What changes
space_api::credentialis the check behind the space reads and behind the authority's methods taken with a credential (as_authority, used bylistWriters).space_auth::verifyas the expectedsub.subis now compared with the requested space last, and a mismatch gets 400InvalidCredential.store.revokednow takes the credential's ownsubinstead of the requested space.A
subthat is not a space URI still gets 401BadJwtSub, as in the reference.Why
In
@atproto/pds0.0.0-spaces-alpha-20261113224550,spaceCredentialAuthverifies the token without an expected subject and checks revocation underparseSpaceSub(payload.sub). The handlers then callassertCredentialSpace, which first throws 401BadSpaceAudienceand then 400InvalidCredential("Credential is not scoped to this space"). This follows on from theBadSpaceSignatureandBadSpaceAudiencepull (A space read's bad signature is BadSpaceSignature, and a wrong audience a 401).How it was checked
just t -p group-host --test spaces --test authoritypasses: 14 and 15 tests. Inreads_only_with_a_credential_the_authority_issued, the "another space of the same authority" case now expects 400InvalidCredential.