Spaces: credentials
Reading a space takes a space credential: a JWT its authority signs, bound to a key the reader holds, presented with an HTTP Message Signature made by that key. This page is how the server takes part in that, as each of the three parties:
- as a user’s PDS, it mints the delegation token an app trades for a
credential:
com.atproto.space.getDelegationToken; - as a space host, it mints credentials for the spaces its accounts are
the authority of:
com.atproto.space.authorizeSpaceSync, with the delegation tokens and client attestations it is given, registering the syncers that ask to be told of the space’s updates; - as a repo host and a space host, it verifies every credential a method
is called with, and refuses one its authority revoked:
com.atproto.space.notifyCredentialsRevoked.
Who takes part, the keys, and the HTTP Message Signature itself are in
Spaces; what every method shares in The PDS: accounts and their records.
The protocol is spaces/proposal.md, “Access control” and “OAuth scopes”;
where this page and the proposal say the same thing, this page is the one to
build from. The three methods’ lexicons are in lexicons/com/atproto/space/,
as the pinned alpha has them (spaces/README.md).
The tokens this server signs
Section titled “The tokens this server signs”A delegation token and a space credential are each a JWT (RFC 7519) in
compact form: the header and the payload, each JSON, base64url without
padding, joined by ., then . and the signature, base64url without
padding. The signature is ECDSA over secp256k1 with SHA-256 of the ASCII
bytes <header>.<payload>, by the signing key of the account named as
issuer (its #atproto, Accounts): 64 bytes, r ‖ s, each 32 bytes
big-endian, with s in the lower half of the order (low-S), as
atproto's Cryptography spec requires. The header is
{"alg": "ES256K", "typ": "<the token's type>", "kid": "#atproto"}and the payload has exactly these claims:
| Claim | Delegation token | Space credential |
|---|---|---|
header typ | atproto-space-delegation+jwt | atproto-space-credential+jwt |
iss | the user’s DID | the space’s authority |
sub | the space, as asked for | the space, as asked for |
aud | <the space's authority>#atproto_pds | none |
cnf | none | {"kid": <the credentialKey asked for>} |
iat | now, in whole seconds since the epoch | the same |
exp | iat + 60 | iat + 600 |
jti | 16 random bytes as 32 lower case hex digits | the same |
Every token has a jti of its own. The server keeps no record of the
credentials it mints.
getDelegationToken
Section titled “getDelegationToken”com.atproto.space.getDelegationToken, a query, ?space=<space-ref>,
answers {token}, a delegation token for the space, signed by the token’s
account, saying that whoever holds it acts for that account. It says
nothing of whether the account may read the space: that is for the space’s
authority to decide when the token is traded. In this order:
spacemissing, or not aspace-ref(Spaces):400 InvalidRequest, whatever the token.- The token, as Sessions says of a bearer token: none is
401 AuthMissing, one the server did not give out400 InvalidToken, one past itsexp400 ExpiredToken, a refresh token400 InvalidToken, andBasicorAtproto-Space-Credential400 InvalidToken. - Only a full session may mint one: an access token of scope
com.atproto.access, or an OAuth access token whosespace:permissions allowreadof the space (OAuth: access tokens on every method, and what scopes allow, “Spaces”; else403 ScopeMissingError). One of scopecom.atproto.appPassorcom.atproto.appPassPrivileged, an app password’s, is400 InvalidToken. - The token’s account deactivated:
401 AccountDeactivated; taken down:401 AccountTakedown(Account lifecycle, taken down before deactivated), for as long as an access token made before lives. A taken-down account’sallowTakendownsession is refused at step 2, as Account lifecycle says.
Any space is answered, whether or not its authority exists or is hosted
here. Called with POST it is 400 InvalidRequest, as The PDS: accounts and their records says.
authorizeSpaceSync
Section titled “authorizeSpaceSync”com.atproto.space.authorizeSpaceSync, a procedure, takes
{space, credentialKey, delegationToken?, clientAttestation?, notify?} and
answers {credential, spaceRev?}: a space credential bound to
credentialKey, and the space’s current revision. With notify, {endpoint, token}, it also registers that endpoint for the space’s updates, or renews
its registration. It takes no authentication: an Authorization header,
whatever it holds, is ignored. In this order, the first that applies
answers:
-
The input checked against the lexicon (The PDS: accounts and their records):
spaceaspace-ref,credentialKeya string,delegationTokenandclientAttestationstrings if given, andnotify, if given, an object withendpoint, a string of the formaturi, andtoken, a string of at most 512 bytes, the empty string included (its other properties are ignored); else400 InvalidRequest. So isGET, and a body that is notapplication/json. -
credentialKeynot a P-256did:key, as Spaces defines one (a compressed point on the curve):400 InvalidRequest. -
The space’s authority not an account on this server:
400 SpaceNotFound. An authority deactivated:400 RepoDeactivated; taken down:400 RepoTakendown(Account lifecycle, taken down before deactivated), whatever the space, the token, the attestation andnotify, aslistWritersrefuses such an authority (Spaces: write notifications, the writer set and syncers): a suspended space’s authority signs no credential. Nothing more is read: a delegation token refused here is not spent. -
The space deleted, as its lifecycle says (Spaces: policies and the space lifecycle):
400 SpaceDeleted, whatever the token, the attestation andnotify, none of which is read: a delegation token refused here is not spent.Note: this is how a syncer that missed a deletion notice (Spaces: write notifications, the writer set and syncers) learns of the deletion, whether or not it may read the space.
-
A
delegationTokenother than the empty string is verified (below):400 InvalidDelegationTokenif it fails. Then, if itssubis notspace,400 InvalidDelegationToken; the token is spent all the same. The token’sissis the user. An emptydelegationTokenis as none. -
A
clientAttestationother than the empty string is verified (below):400 InvalidClientAttestationif it fails. Itsissis the client. An empty one is as none. -
A space the authority never created:
400 SpaceNotFound. A delegation token verified at step 5 is spent all the same, here and at every step after. -
The user perimeter:
authorize_read(space, user, client)(below, “For the other parts”), with no user when no delegation token was given. Refused:400 SpaceNotFound.Note: this is so that a refusal says nothing of whether the space exists.
-
The app perimeter:
authorize_app(space, client), with no client when no attestation was given. Refused:400 AppNotAuthorized.Refused at step 8 or 9, a request with
notifywithdraws the registration of its endpoint and token for the space, if there is one (Spaces: write notifications, the writer set and syncers, “Registering”): a syncer that has lost access is told nothing more. A refusal at an earlier step leaves it as it was, and so does a policy that cannot decide (a managedspace’s app that does not answer), which answers502 UpstreamFailureat step 8 or 9 as Spaces: policies and the space lifecycle says (“Asking a managing app: checkAccess”). -
With
notify, a registration not yet made is confirmed with its endpoint first (Spaces: write notifications, the writer set and syncers, “Registering”): refused with400 TooManyRegistrationsor400 RegistrationNotConfirmedthere, nothing is registered and no credential is minted. One registered already, lapsed or not, is not confirmed again. -
The credential, signed by the authority,
issthe authority,subspaceandcnf.kidcredentialKey, as above. Withnotify, the registration is then made or renewed, to lapse when this credential expires (Spaces: write notifications, the writer set and syncers, “Registering”). -
The answer:
credential, andspaceRev, the space’s revision as it is once the registration is made (Spaces: write notifications, the writer set and syncers, “The writer set”), so that every update after it is sent to the registration;spaceRevis left out while the space’s writer set is empty.
The lexicon’s AccountNotAuthorized and NotAuthorized are never
answered: step 8 answers SpaceNotFound instead, as the lexicon allows.
Verifying a delegation token
Section titled “Verifying a delegation token”A delegation token fails, and step 5 answers InvalidDelegationToken, when
any of these holds, in no particular order, as all answer the same:
-
it is not three parts joined by
., or its header or payload is not base64url of a JSON object, or its signature not base64url; -
the header’s
typis notatproto-space-delegation+jwt, itsalgnot a non-empty string, or itskidnot#atproto; -
the payload has no
iss,suboraud, anexpthat is not a number, or ajtithat is not a non-empty string; -
expis 5 seconds or more in the past (now − 5 ≥ exp, in whole seconds): a token is taken for up to 5 seconds after itsexp, for clocks that differ; -
expis more than 3600 seconds ahead (exp − now > 3600): a token whoseexpis a day off is refused. Nothing else bounds its life:iatis not read;Note: this is so that no token is kept long (below, “Single-use values”).
-
issis not a DID, or its DID document cannot be read, or names no#atprotokey (below, “Issuers’ keys”); -
the signature does not verify against that key (below);
-
subis not aspace-ref, oraudis not exactly<sub's authority>#atproto_pds: a bare DID, or another authority’s, is refused; -
it was taken before (below, “Single-use values”).
Other claims, as lxm or cnf, are not read. A token is spent when it
passes all of these, before its sub is compared and steps 6 to 12: one
refused there is spent all the same.
Verifying a client attestation
Section titled “Verifying a client attestation”A client attestation is a private_key_jwt client assertion addressed to
the space host (proposal, “Client attestation”). It fails, and step 6
answers InvalidClientAttestation, when:
- it is not three parts as above; its header’s
typis notatproto-client-attestation+jwtor itsalgnot a non-empty string; its payload has noiss,suboraud, anexpthat is not a number or is more than 3600 seconds ahead (exp − now > 3600), no non-empty stringjti, or anissother than itssub. Nothing is fetched for an attestation that fails here; - the client’s metadata cannot be had:
issis the client’sclient_id, anhttpsURL, fetched withGETandAccept: application/json, which must answer200with a JSON object that is client metadata as atproto's OAuth spec says. Its keys are itsjwks, or, without one, the JSON Web Key Set itsjwks_urianswers, fetched the same way; with neither, it fails. Each fetch goes through Proxying, service auth and preferences’s guard (“SSRF protection”): with protection on, only to a public host name, no IP address and nolocalhost, resolving only to public unicast addresses. With protection on or off, it follows no redirect (a3xxis as no answer), reads at most 524288 bytes (a longer answer is as none), and is given up after 10 seconds; - its signature does not verify (RFC 7515) with the key of that set whose
kidis the header’skid, under the header’salg; or itsaudis not<the space's authority>#atproto_pds; or itsexphas passed; - it was taken before (below, “Single-use values”).
The client is then its client_id. The server may keep what it fetched for
up to an hour.
Presenting a credential
Section titled “Presenting a credential”A method that takes a space credential is called with the four headers Spaces names (“HTTP Message Signatures”), the signature’s label any name, as in:
Authorization: Atproto-Space-Credential <credential>Atproto-Space-Audience: <a DID>Signature-Input: sig=("authorization" "atproto-space-audience");tag="atproto-space-credential"Signature: sig=:<64 bytes, base64>:The Authorization scheme is matched without regard to case, as
Sessions says of every scheme; a header that is not two words
separated by one space is 400 InvalidToken. Each method says whether it
takes a credential and what audience it derives from its request: for a
method of a repo in a space, the repo’s DID; for a method of the space
host, the space’s authority. A method that takes a session token and no
credential answers the Atproto-Space-Credential scheme 400 InvalidToken, as any scheme it does not take; one that takes no
authentication ignores it.
Verifying a credential
Section titled “Verifying a credential”verify_space_credential(request, audience) answers the credential’s
space, jti and cnf.kid, or refuses the request. The checks are in this
order, the first that fails answering, each 401 with the error named:
| # | Refused when | Error |
|---|---|---|
| 1 | the token is not three parts joined by ., its header or payload is not base64url of a JSON object, or its signature is not base64url | BadJwt |
| 2 | the header’s typ is not atproto-space-credential+jwt | BadJwtType |
| 3 | the header’s alg is not a non-empty string, or its kid not #atproto | BadJwt |
| 4 | the payload has no iss | BadJwtIss |
| 5 | the payload has no sub | BadJwtSub |
| 6 | exp is not a number | BadJwt |
| 7 | cnf.kid is not a DID | BadJwtCnf |
| 8 | jti is not a non-empty string | BadJwt |
| 9 | iat is not a number, exp ≤ iat, or exp − iat > 3600: no credential lives more than an hour | BadJwt |
| 10 | iat is more than 5 seconds ahead (iat > now + 5) | BadJwt |
| 11 | exp is 5 seconds or more in the past (now − 5 ≥ exp) | JwtExpired |
| 12 | iss is not a DID | BadJwt |
| 13 | iss’s DID document cannot be read, or names no #atproto key | BadJwtIss |
| 14 | the signature does not verify against that key, or its alg is not that key’s | BadJwtSignature |
| 15 | sub is not a space-ref | BadJwtSub |
| 16 | iss is not sub’s authority | BadJwtIss |
| 17 | Atproto-Space-Audience is missing or not a DID | BadSpaceSignature |
| 18 | the HTTP Message Signature does not verify against cnf.kid as Spaces says, cnf.kid not a P-256 did:key included | BadSpaceSignature |
| 19 | the credential’s space and jti are revoked here (below) | CredentialRevoked |
| 20 | Atproto-Space-Audience is not audience | BadSpaceAudience |
The credential may carry other claims, aud too: they are not read. Then
the method compares the credential’s space with the space its request
names: another is 400 InvalidCredential. Nothing here asks whether the
space exists, or whether its authority is active: a repo host knows
neither.
So a credential works at any host, for any audience, as many times as it is sent, until it expires or that host has it revoked; and a request signed for one audience is refused at another.
Issuers’ keys
Section titled “Issuers’ keys”A token’s issuer key is the #atproto verification method of the issuer’s
DID document: for a did:plc, the document the directory at PDS_PLC_URL
serves; for a did:web, its host’s /.well-known/did.json (below). Its key is
ES256K for a secp256k1 key and ES256 for a P-256 key, and a token whose
alg is the other’s does not verify. The signature is 64 bytes, r ‖ s,
and must be low-S: a high-S signature, which atproto's Cryptography spec
calls malleable, does not verify.
An issuer that is an account here, active, deactivated or taken down (Account lifecycle) but not deleted, has its token verified first against the key the server holds for the account, with nothing read; a token that does not verify against it is verified as any other issuer’s is, below. So the server reads no document for the tokens it signs itself, its accounts’ delegation tokens, credentials and service auth, however many there are. A deleted account’s DID is any other issuer’s: its document is read.
For any other issuer the server keeps the key it read, with when the read began:
- A key read less than
PDS_DID_CACHE_SECSago (Limits) is used. - A key read longer ago, but less than
PDS_DID_CACHE_MAX_SECSago, is used too, and a token it verifies is answered at once, the document read again after it: a key in use is renewed with no call waiting for it.PDS_DID_CACHE_MAX_SECSbelowPDS_DID_CACHE_SECSis taken asPDS_DID_CACHE_SECS. - An issuer with no key kept, or one read
PDS_DID_CACHE_MAX_SECSago or longer, has its document read before its token is verified. - When a signature does not verify against a key kept, the document is read again, and the token verifies if it verifies against the key read then; so a token signed with a key the issuer has just rotated to is taken at once.
- One issuer’s document is read at most once at a time: a call that needs it while it is read waits for that read, and takes the key it gave if that key is kept as above and is not one its token failed against.
- It keeps at most one key for each 1024 bytes of
PDS_CACHE_BYTES(The store: what is kept, the backfill window, and the bounds): 262144 by default. Past that, the key used longest ago is forgotten. - The keys kept are written to
PDS_DATA_DIR/issuer-keysat a shutdown (SIGTERMorSIGINT, Operations) and at most once a minute while they change, never synced: a cache, not state. A start reads it back in the background, dropping any key readPDS_DID_CACHE_MAX_SECSago or longer; until it has, a token is verified as if no key were kept, and a key read since the start is kept over the file’s for the same issuer, and counts as used later than any of the file’s. A file that is missing, cannot be read, or is not as the server writes it, is as none.
With PDS_DID_CACHE_SECS=0 no key is kept, and every token’s issuer’s
document is read for it, but for the issuers that are accounts here.
Note: an issuer whose tokens come often, as a user’s to an app that syncs a space, would otherwise have every call that found its key expired wait for the directory; and a server’s start, every issuer at once. The windows are the reference’s: it keeps DID documents an hour, and serves them while it reads them again for up to a day.
A did:web document is fetched as Proxying, service auth and preferences’s guard allows (“SSRF
protection”): with protection on, only over https from a public host
name, no IP address (did:web:127.0.0.1%3A8443, did:web:10.0.0.5) and
no localhost, resolving only to public unicast addresses; with it off,
from any host, and from localhost over http
(did:web:localhost%3A2583 from
http://localhost:2583/.well-known/did.json). Either way it follows no
redirect (a 3xx is as no answer), reads at most 65536 bytes (a longer
document is as one that cannot be read), and is given up after 10
seconds. It is fetched in the pool Limits keeps for did:web
documents, apart from the directory’s slots, and a call that presents such
a token has paid its rate limits before it is fetched (Limits, “Rate
limits”). A document that cannot be fetched so is one that cannot be read:
the token’s issuer has no key.
Revocation
Section titled “Revocation”com.atproto.space.notifyCredentialsRevoked, a procedure, takes {space, credentials}, one to a hundred jtis, each a non-empty string, and
answers 200 with no body. It is how a space’s authority tells a repo host
to refuse those of the space’s credentials before they expire. This server
never sends one; it takes them.
It is authenticated with service auth (atproto's HTTP API (XRPC) spec, “Inter-Service
Authentication”): a bearer JWT signed by the authority. The token is checked
before the input, in this order, each 401 with the error named:
| Refused when | Error |
|---|---|
no Authorization header, an empty one, or one whose scheme is Basic, DPoP or Atproto-Space-Credential | MissingJwt |
it is not three parts joined by .; its header is not a JSON object with a string alg; or its payload is not a JSON object with a number exp | BadJwt |
the header’s typ is at+jwt, refresh+jwt or dpop+jwt (any other, or none, is taken) | BadJwtType |
exp has passed (now > exp) | JwtExpired |
lxm is not com.atproto.space.notifyCredentialsRevoked | BadJwtLexiconMethod |
iss is not a DID, or a DID and a # fragment | BadJwtIss |
iss’s DID document cannot be read, or names no #atproto key | AuthenticationRequired |
| the signature does not verify against that key (below) | BadJwtSignature |
A scheme the server does not know, or a header that is not two words, is
400 InvalidToken, as Sessions says. The signature is held to the
issuer’s key as above (“Issuers’ keys”), except that a high-S signature is
taken too. kid, iat and jti are not read, and the same token may be
sent again until it expires. Then:
- The input checked against the lexicon:
400 InvalidRequest. iss, as written, not the authority ofspace:403 Forbidden.audnot the DID, bare, of an account on this server:403 Forbidden. A DID with a fragment, the server’s owndid:web, or an account elsewhere, is refused.- Each
jtiis kept, with the space, as revoked: from then on any credential of that space with thatjtiis refused here (CredentialRevoked), whatever accountaudnamed and whatever audience it is presented to. Ajtirevoked in one space is not revoked in another. The space need not exist.
A revocation is kept for at least 3610 seconds after it was last received; receiving it again starts that time again. Revocation is per host: another host, the space host too, takes the credential until it is told.
Note: 3610 seconds is an hour, a credential’s longest life, and twice the
5 seconds a clock may differ by, after which no credential with that jti
can still be taken.
As a space host, the server revokes none of the credentials it issues: a syncer’s registration lasts until the credential of its latest authorization expires (Spaces: write notifications, the writer set and syncers, “Registering”), and is never dropped for a revocation. A revocation it takes is a repo host’s, as above, and changes no registration.
Single-use values
Section titled “Single-use values”Delegation tokens and client attestations are each taken once: the server keeps them in its record of single-use values (OAuth: the authorization server, “Single-use values”), which survives restarts and forgets each entry when its time has passed:
| Namespace | Value | Kept until |
|---|---|---|
| delegation tokens of an issuer | the token’s jti, per iss | 5 seconds after the token’s exp |
| client attestations of a client | the attestation’s jti, per client_id | its exp |
A jti is single-use per issuer: another account’s token with the same
jti is taken. As neither a delegation token nor an attestation is taken
with an exp more than 3600 seconds ahead, no entry is kept more than
3605 seconds.
Durability
Section titled “Durability”As Durability says of the rest: a revocation the server answered 200
to, a delegation token it spent and an attestation it took survive the
server being killed, for as long as each is kept.
As tools and commands
Section titled “As tools and commands”The three methods are MCP tools and CLI commands as Commands: every method as an MCP tool and a CLI command says:
space_get_delegation_token (pds space get-delegation-token --space …),
space_authorize_space_sync (pds space authorize-space-sync) and
space_notify_credentials_revoked, whose answer, none, is {}. Each
answers JSON, so each has a tool, with the hints of Commands: every method as an MCP tool and a CLI command’s
“Hints”: getDelegationToken and authorizeSpaceSync sign a token, the
latter keeping a registration too, and change nothing else, so neither is
read-only nor destructive; notifyCredentialsRevoked ends a credential, so
it is destructive. notifyCredentialsRevoked’s service-auth token is the
bearer token a tool or command is given (PDS_TOKEN), as any other.
For the other parts
Section titled “For the other parts”verify_space_credential(request, audience) -> {space, jti, kid}: every method that takes a credential calls it (above, “Verifying a credential”), with the audience it derives, and then answers400 InvalidCredentialwhenspaceis not the space its request names. The space repo’s read methods take it with the repo’s DID as audience; the space host’s methods with the space’s authority.authorize_read(space, user_did?, client_id?) -> boolandauthorize_app(space, client_id?) -> boolare the policies’ (their page says how each policy answers).authorizeSpaceSyncasks the first with the delegation token’s user, or none, and the attested client, or none; then the second, only when the first allowed.- Registrations are the notifications’ (Spaces: write notifications, the writer set and syncers,
“Registering”). With
notify,authorizeSpaceSyncwithdraws the pair’s registration when step 8 or 9 refuses; at step 10 has a new one confirmed, or refused; and at step 11 makes or renews it, to lapse at the credential’sexp. ItsspaceRev(step 12) is the writer set’s. - OAuth.
getDelegationTokenis the method aspace:grant reaches (proposal, “OAuth scopes”): an OAuth access token whose scope grantsread(not onlyread_self) of the space may mint a token for its account, as a full session may. An app password’s session may not.
Where the reference departs from this page
Section titled “Where the reference departs from this page”- A client attestation that fails step 1 above (malformed, the wrong
typ,issother thansub, or a claim missing) is500 InternalServerErrorfrom the reference; the server answers400 InvalidClientAttestation, as the lexicon names it. - The reference forgets a spent delegation token at its
exp, though it takes the token for 5 seconds more; the server keeps it until then. - The reference keeps spent tokens in memory: they are taken again after it restarts. The server keeps them across restarts.
- The reference takes a delegation token or a client attestation whose
expis any time ahead, a day or a year; the server refuses one more than 3600 seconds ahead. - The reference runs with no SSRF protection, and with it off fetches a
client’s metadata over
httpfromlocalhost; what the guard refuses is the server’s alone.
The harness does not compare these.
How it is checked
Section titled “How it is checked”The spaces run (Spaces) starts a second alpha PDS beside the first, the
peer, on the same directory. Each check is made twice, once with the
alpha in a role and once with the server in it, the peer or the first alpha
playing the other roles both times; the answers are compared as The PDS: accounts and their records
says (status and error; DIDs named by role), and each side is held to
this page. In this order:
- The server as user’s PDS, the space host the first alpha. A member on
each side asks for a delegation token: its claims must be as above and
verify against the account’s key, and the alpha must trade it for a
credential, once. Refused alike: no token, an app password’s, a
privileged one’s, a refresh token,
Basic, a credential, input the lexicon refuses. This needs nothing of the server but this page. - The server as space host, the members’ repo host the peer. On each
side an authority makes, with the policies’ methods, a memberspace with a
member on the peer, who writes a record into it there, a public one, a
personalspace, one with
allowedApps, and a deleted one. The member’s delegation tokens, from the peer, are traded with each side: the credential’s header and claims must be as above and verify against the authority’s key in the directory, low-S; the answer has aspaceRevfor the memberspace and none for the public space no one wrote to; and the peer, as the member’s repo host, must take the credential for the member’s records. Then each step ofauthorizeSpaceSyncrefused, on both sides alike: replays, a token spent by a refusal (of the app perimeter, of a space never made), the wrong space, no token, a non-member’s token,credentialKeys that are no P-256 key (one for a space not hosted, the key answered first), input the lexicon refuses, a space not hosted, missing or deleted, each with and without a token and with a token that is no JWT (the deleted and the not hosted answered first; a token presented for the deleted space not spent, and taken once the space is created again), and delegation tokens the harness signs with the member’s key, each with one thing wrong (or, for those taken, one thing unusual: noiat, issued 59 minutes ahead, anexpan hour ahead, an extra claim, ajtianother account used,exp2 seconds past). Attestations: one whose client cannot be fetched is compared; malformed ones are held to this page alone (above);allowedAppswith none isAppNotAuthorized. Held to this page alone: delegation tokens whoseexpis 3610 seconds and a day ahead, refused; and an attestation whoseexpis a day ahead, of a client athttps://localhost:<port>, a listener the harness runs that counts connections: refused with no connection, while one whoseexpis a minute ahead connects there.notifyis checked with the notifications (Spaces: write notifications, the writer set and syncers, “How it is checked”). - The server as repo host, the space host the first alpha. A writer on
each side, a member, writes a record into the alpha’s space with the space
repo’s
createRecord, and is read withcom.atproto.space.listRecords, presenting credentials the alpha issued and ones the harness signs with the authority’s key, each with one thing wrong, row by row of the table above, and HTTP signatures each with one thing wrong, or with a label of their own, or beside another signature untagged (taken), or tagged twice (refused). Then the authority’s revocations, with service auth the harness signs, each with one thing wrong; a revoked credential refused, another space’sjtinot; and an authority whose key is rotated in the directory, after its old key was used. - A restart of the server: a revocation it took, and a delegation token it spent, are refused after it.
- Account states, in the policies’ stage 5 (Spaces: policies and the space lifecycle), on
each side an account deactivated, then another taken down by the admin:
its
getDelegationTokenwith its token from before is refused, aspacethat is nospace-refanswered first; andauthorizeSpaceSyncof its space, it the authority, with no token, with a user’s token from the peer (which is not spent), with a token that is no JWT, and of a space it never made, isRepoDeactivatedorRepoTakendown, while acredentialKeythat is no key, and input the lexicon refuses, are answered first. Compared once the server can put an account in each state; until then the reference alone. - The guard (
harness/spaces/ssrf.mjs, near the end of the run), the server alone. First as the run starts it, protection off: an issuerdid:web:localhost%3A<port>whose document a harness listener serves overhttpis taken for a revocation; one whose host answers302to another that serves it, and one whose document is 70000 bytes, areAuthenticationRequired, the redirect’s target never asked, while one of 60000 bytes is taken. Then the server is started again withoutPDS_DISABLE_SSRF_PROTECTION, and plain TCP listeners on127.0.0.1count connections: revocations andnotifyRepoUpdatewith service auth fromdid:web:localhost%3A<port>anddid:web:127.0.0.1%3A<port>(AuthenticationRequired), delegation tokens from them (InvalidDelegationToken), attestations of clients athttps://127.0.0.1:<port>andhttps://localhost:<port>(InvalidClientAttestation) and a credential from such an authority (BadJwtIss) are each refused, and no listener sees a connection; so are syncers’ endpoints there (Spaces: write notifications, the writer set and syncers, “How it is checked”). The server is then started again as the run starts it. - Issuers’ keys (
harness/spaces/issuers.mjs, after the guard), the server alone: revocations with service auth fromdid:webissuers whose documents a harness listener serves, recording each read. Started again withPDS_CACHE_BYTES=65536, so that it keeps 64 keys: eight at once from an issuer not read before, its document 400 ms slow, are each taken with one read of it; then 65 more issuers, one revocation each, after which one from the second of them reads nothing and one from the first reads its document again; then shut down bySIGTERMand started again, a second later one from that second issuer reads nothing and one from the third, forgotten before, reads its document; then shut down bySIGINTand started again, one from the third reads nothing. Started again withPDS_DID_CACHE_SECS=3andPDS_DID_CACHE_MAX_SECS=8: from a new issuer, one 3.5 s after its document was read, the document now 1.5 s slow, is answered within 1 s, and the document is read once more after it; and one 9 s after that read waits for a read of its own. The server is then started again as the run starts it. That an issuer that is an account here has nothing read is checked with the directory’s requests (Limits, “How it is checked”).
What the reference cannot say: that the server’s revocations last 3610
seconds, and that a token past 5 seconds after its exp is refused while
still kept, which would take the run that long; that the server signs only
low-S, beyond each token checked; an attestation that verifies, which
needs a client’s metadata at an https URL the run cannot serve, and so
an attestation jwks_uri fetched through the guard, or past 524288 bytes;
that a fetch is given up after 10 seconds, and the did:web pool’s bound,
which are time and load; and that a public host resolving to a private
address is refused, which needs a name the run does not control.