chadtmiller.com/group-host
atmosphere group host
The console signs people in with atproto-client's OAuth client
MergedThis moves console sign-in, sign-up and the account-move sign-in onto atproto-client 0.4's OAuth client, with two clients under one client id and key. I read all 17 changed files and found nothing that has to change.
-
Browser binding.
come_backreads the waiting request by its state without consuming it. It then requires three things before the crate redeems the code:- the request's
redirect_uriequals this callback; - the browser's cookie matches the secret in
app_state; - for a move, the mover is still the signed-in caller.
A move request can't be completed at
/console/callback, and a console request can't be completed at the move callback. - the request's
-
Move bookkeeping.
keep_movereplaces another person's move of the same account and returns the account this mover had before, sogive_backrevokes it. It skips the case where it is the same account. Swept and cancelled moves revoke throughmoving.revoke(did), which also drops the stored session. -
Refresh handling.
as_movingretries once after a refresh on a 401, andlapsedexcludesuse_dpop_nonce.NoRefreshandinvalid_grantbecomeSignInAgain.RepoNotFoundstill maps toNonebefore the lapse check, andat_mostreplaces the old capped reads. -
Migration, docs and change file. The migration drops the old tables and in-flight moves are let go, as the body says. The change file,
signing-in.md,api.mdandconfig.mdmatch the behaviour changes the body lists. -
Tests. They cover the new paths: expired request, store failure, revoked grant, refresh refused with each error, second-account move, and a pre-upgrade database.
When I read the checks, test, e2e, docs and check were still queued, so I could not see the coverage gate or the e2e result. Both gate the merge, so I'd wait for them.
One small thing, not worth blocking on: if keep_move fails after the crate has stored the session in move_session, the session is orphaned until the next sign-in to that account replaces it.
The only change since my approval is in console_login.rs. take_request and request now bind the connection guard to a local before the query. The SQL and results are the same, and the behaviour is unchanged. What I approved stands. As before, test, e2e and the coverage gate gate the merge, so wait for them.
9 passed
What changes
Sign-in through the crate. Signing in to the console, signing up at
SIGNUP_PDS, and signing in to an account to move here go throughatproto_client::oauth(atproto-client 0.4.0).console_login::clientsbuilds two clients under the one client id and key (private_key_jwt, kidconsole). One signs people in. It keeps sessions in memory and revokes each one straight after its callback. The other signs in to accounts being moved here and keeps their sessions in the database (account_move::Moves). Each has its own callback,/console/callbackand the new/console/move/callback. They are kept apart because the crate's callback ends any session its client already keeps for the same DID: with one shared client, signing in to the console as an account would end that account's move.Stores. A migration drops
console_loginand replaces it withconsole_request, the crate'sPendingkept whole by its state, which both clients share (console_login::Requests).account_movekeeps only mover → DID → started. Its session lives inmove_session, by account. What the sign-in carries (back, the browser's cookie secret, andmover) travels in the request'sapp_state. Before the code is redeemed, the callback reads the waiting request by its state and refuses it unless the browser holds the matching cookie, the request was made for this callback, and, for a move, the mover is still the one signed in.Account move. Its own DPoP loop is gone. Calls go through
client.pds(&session)withclient.auth, andservice_auth::tokenasks for the createAccount token. The session is refreshed when it is about to lapse, and once more when the server answers 401 to a lapsed token.NoRefreshandinvalid_grantanswerSignInAgain. Answers are capped withXrpc::at_most:ANSWER_AT_MOSTfor JSON,REPO_AT_MOSTfor repos and files. Signing in to move another account gives back the one before. Another person's move of the same account is replaced.Metadata. The client metadata comes from
atproto::oauth::WebClient::metadata, the full confidential web client profile, with both redirects. WhereCONSOLE_URLis not https at a public name it answers 500 and says why.Telemetry. The host's
Guardedclient now sends throughobserve::Calls, so every guarded call is logged as acallline with atraceparent. That covers the proxy, notify, syncers, client metadata and a group's domain. The changes for 0.4'sAsking/SendErrorare inauthority,group_domainandoauth_clients.Deleted.
console_post,sign_in_at,authorization_server,signed_up,Pending,console_key's inline client assertions, the move'sMoverow (issuer, endpoints, key, tokens),renew, the hand-writtenas_movingDPoP/nonce loop,challenged, and theconsole_logintable.Why
The host had its own copy of the confidential OAuth client. The crate's copy checks more than it did: the server metadata against the full profile, the authorization server read again from the DID at the callback and before each refresh, and revoking a grant it refused. It is the same client the other apps use.
Behaviour changes, in the change file and
docs/design/signing-in.md:iss(a callback withoutissis refused, as before), and list the required methods.https://…URL in place of a handle signs in whoever logs in at that server, as the crate'sauthorizetakes it.subis no DID answers 400 (was 403).How it was checked
Clippy with warnings denied passes for the workspace. Run locally: console_login, account_move, domain, oauth_clients, proxy, authority, addresses and spaces. Both mock authorization servers now serve full profile metadata (
tests/common/oauth::server_metadata) and resource metadata withresource. New tests:UnknownState)invalid_requestandinvalid_grantcommon::rewindnow remakes a dropped table with the columns later migrations added. The full gate and e2e are left to CI.Shortcomings
authorizedoes not return the state, so the browser binding lives inapp_stateand the callback peeks at the request in the host's own store. The console client keeps its session in memory and revokes it straight aftercallback. atproto-client 0.5.0'sauthorizereturning the state andcallback_unkeptwould replace both, in a follow-up.service_callerand the account-import token still useResolver::with_key, notservice_auth::verify_any. That is left for a follow-up.at_mostis tested in the crate.