chadtmiller.com/group-host
atmosphere group host
The host resolves identities and asks others' hosts with atproto-client
MergedThis moves the host's outbound guarding, identity resolution and service-token checks, and atgrp's calls, onto atproto-client. I read the changed source files in the host and atgrp, but not Cargo.lock, the tests, the docs or the changeset. The test, e2e and docs checks were still queued or running, so I could not see them pass.
I found nothing that must change. The guarded call sites keep the old rules: each URL goes through guarded.get, post or request, or may_ask where DPoP signs the URL first. The forget calls before resolve_handle in names and group_handle::named keep those two checks fresh, as the body says.
One thing to confirm, which I can't check without the crate's source: delegated in authority_api.rs used to require aud == space_host_aud(space.authority). It now checks only sub against the space. This is safe only if verify_delegation itself requires the aud derived from the token's sub authority. If it doesn't, a delegation token minted for another audience would now pass. A test that a delegation token with a wrong aud is refused would settle it, in the crate or here.
The shortcomings listed in the body are fair. I have no objection to leaving them for later.
I read what changed since my approval at 0d58c58. It bumps atproto-client to 0.2 and atproto to 0.4.3. It also adds observe::Calls, a Sender that the resolver now uses. Calls logs each identity or token call as a call line, and a refusal as refused. When the call is made while answering a request, Calls also sends a traceparent for that request's trace. The tests, docs and changeset are updated to match.
What I approved stands. The test changes only follow the crate's new error wording. The fragment case now expects answered 404, which follows from a URL fragment never being sent.
Two small notes, neither blocking:
- The
traceparentcarries a trace id that the original caller may have chosen. The host passes that id on to the PLC directory and to handle and DID hosts. This is harmless, and it is documented as a trace the caller names. - My earlier question about
verify_delegationand the aud was not answered in this round. I still can't check it without the crate's source. A test that a delegation token with a wrongaudis refused would settle it.
I read what changed since my approval at 8a633bd, and what I approved stands. The change is small. oauth_clients.rs now includes the error's causes when a document fetch fails ({:#}), so a refusal from the guard shows its reason. The oauth_clients and proxy tests change to match the crate's wording ("public address", "not on https"). It touches only error text, not the guard rules. My earlier question about verify_delegation and the aud is still open. A test that a delegation token with a wrong aud is refused would settle it, but I'm not blocking on it.
I read what changed since my approval at 12ad354, and what I approved stands. The changes are small refactors that keep behavior:
atgrpnow returnsOk(None)forRepoNotFoundwiththen_some/ok_or_else.- The syncer delivery and the group-domain
reachescheck now useOptionFuture. A refused URL still counts as a failed delivery (Retry) or as not reached. - A rustfmt change in
oauth_clients.rs.
The change in tests/authority.rs adds a case where a delegation token for another space of the same authority is refused. That partly answers my earlier question about verify_delegation and the aud. It covers a wrong space, not a wrong aud, but I'm not blocking on that.
I read what changed since my approval at 65628d5, and what I approved stands.
console_post: the removedmay_askpre-check was redundant. The call still goes throughself.guarded.post(url), which applies the guard rules. The newftp://test case shows a refusal ("is not on https").atgrp: asaidhelper replaces the repeatedmap_err(failed…)calls.own_bytesstill returnsOk(None)forRepoNotFoundand reports other errors as before.
Nothing needs to change.
9 passed
What changes
Guarded requests.
guard.rs(pinned_client,public,Host::pinned,Host::at_pds) is gone.Hostholds oneatproto_client::guard::Guarded, built inHost::open(Guard::allowing_private()wherePUBLIC_URLis http,Guard::strict()otherwise). It serves every call to a host others' data names: notifyRepoUpdate and notifyCredentialsRevoked to a PDS, the index's reads, getSpaceBlob, a group's own domain, OAuth client metadata (and so lexicons and logos), syncer endpoints, the proxy, an account's server while it moves, the console's sign-in posts. Each call is held to the same rules as before, and the connections now pool instead of a new client per request.Identity.
identity.rsis gone.Host::identityis the crate'sResolverwith its defaultMemorycache (five minutes, 10 000 entries, asKEPT_FOR/KEPT_AT_MOSTwere).lib::resolverbuilds it from config:DID_WEB_HOSTSgoes toreading_at(as<DID_WEB_SCHEME>://<address>),DID_WEB_SCHEME=httpturns onon_http, andHANDLE_RESOLVERSbecomesHandleResolver::WellKnown/Xrpcin the order given. Every place that read a document now (document) callsdocument_now; the space outbox, which read the kept document first, callspds. Handle resolution in actors, api, console sign-in, group handle and import moves toresolve_handle.Tokens. A space's delegation tokens are checked with
service_auth::verify_delegation, and then theirsubagainst the space asked for. A group's token for moving here is checked withservice_auth::verify(audSERVICE_DID, lxmmigrateReceive).Telemetry. The workspace moves to atproto 0.4.3 and atproto-client 0.2.0.
observe::Callsis theSenderthe resolver uses, so every identity read and service-token check goes through it. On each attempt it adds atraceparentnaming the trace of the request being answered (held in a task-local set byobserve) and logs onecallline with the host, path, status or error,resendandduration_ms. It logs eachXrpcErrorthe client returns asrefused. group-host has noidentity::heardto send those to.docs/reference/api.mddescribes both lines.atgrp.
Clientcalls hosts and its own PDS throughxrpc::Xrpc: sign-in,call,query, andown_query/own_call/own_bytes, which replaceown. It gets its service tokens fromservice_auth::token. Errors read as they did before:<what>: <status> <error> <message>, orreaching <url>.Config.
HANDLE_RESOLVERSnames the/.well-knownresolver aswell-known, where it used to takewell-known:<scheme>. The scheme now followsDID_WEB_SCHEME. The old form stops the host at startup with an error. WithDID_WEB_SCHEME=http, any name counts as a handle, so127.0.0.1:<port>works. Handles are cached for five minutes, but the group-domain check and import'snamescallforgetfirst, so those two still ask fresh.Why
Each app had its own copy of the guard, the resolver and the token checks.
atproto-client0.1 is a single shared, tested copy of that code, and building the guarded client once lets its connections pool.How it was checked
cargo clippy --workspace --all-targets -D warningspasses. Ran locally: the config, group_handle, authority and addresses tests. The tests that checked the old guard and resolver (tests/identity.rs) now live in the crate. The store-backfill test that was in that file moved totests/addresses.rs. The full gate and e2e are left to CI.Shortcomings
Guard::may_askdoes not refuse fragments, so the host now fetches the URL without its fragment. Small crate fix: refuse a fragment inmay_ask.Guardedcalls (proxy, notify, syncers, getSpaceBlob, index reads) do not go throughCalls:Guardedhas noSenderhook of its own. The crate could addGuarded::sending.Resolver::forgetdoes not lowercase its key, butresolve_handledoes. The host only passes lowercase handles.account_move's getServiceAuth still goes through the move's OAuth session (DPoP, nonce, renewing oninvalid_token). That is session code.service_auth::tokentakes a fixedAuth, so moving this call would mean writing the renewal again.Resolver::with_keyand are not checked byservice_auth::verify:service_caller, and the token for importing an account. Those routes accept more than one audience (the host's DID orDID#service, a space's authority or its host aud) and name each refusal separately. The crate'sverifytakes exactly oneaud.send(a raw-body procedure with query params) andGroupSession(a DPoP proof whosehtuis the host's public URL, not the address it is reached at, and a bearer token with a proof for getGroupAuth) are still written by hand. The crate'sXrpchas neither.