chadtmiller.com/group-host
atmosphere group host
The host asks no host a DID or handle names at a private address
MergedThis moves the pinned-client guard into guard.rs and applies it to did:web hosts, handle /.well-known/atproto-did, and the PDS a DID document names. That covers the notify calls, the index reads, getSpaceBlob and the group-domain check. It also tightens public for IPv6 to global unicast only. I read the code changes and found no bug. Redirects are off, and the pin is applied before each request. The operator-configured services (PLC, handle resolvers, DID_WEB_HOSTS, DOMAIN_CHECK_AT) are exempt, as the body says. I read the source files and the guard's logic. I did not read the test files, docs or changeset, and I did not run the checks.
Two non-blocking notes:
console_login.rs:402,import.rs:175andmigration.rs:532still calldid::pdson a DID document. I did not check whether they then call that PDS with the plain client. If they do, they are the same kind of hole, and a follow-up should guard them or the body should say why not.permission_sets.rsis already guarded throughpublic_json.Host::at_pdsandHost::pinnedreturnResult<_, String>, so each caller converts withanyhow::Error::msg. This is fine as it is.
8 passed, 1 skipped
What changes
The hosts identity data names are guarded. A
did:web's/.well-known/did.json, a handle's own/.well-known/atproto-did, the PDS a DID document names (told of a write in a space bynotifyRepoUpdateor of revoked credentials bynotifyCredentialsRevoked, read by the index for a writer's repo, or for a file bygetSpaceBlob) and a group's own domain (checked byputGroupDomainwhenDOMAIN_CHECK_ATis unset) are now asked only over https, at public addresses, the connection pinned to the addresses checked, with no redirect followed. A host whosePUBLIC_URLis http, a network of test servers, asks them over http too, at any address, as it already did for client metadata, syncer endpoints and proxied services.One guard, in its own module.
crates/group-host/src/guard.rsholds whatoauth_clients.rsalready had, moved there whole rather than written again:public(ip),pinned_client(url, http_here)andHost::pinned, plusHost::at_pds(doc, nsid), a pinned client for a method at the PDS a document names.identity::Resolvertakeshttp_here(bool)(set fromPUBLIC_URLinHost::open) and asks adid:web's own host and a handle's throughpinned_client, withinLOOKUP(3 s).publicnow takes an IPv6 address as public only in global unicast (2000::/3, less documentation's), so an address carrying an IPv4 one (NAT6464:ff9b::/96, IPv4-compatible::a.b.c.d) and site-localfec0::/10are no longer taken as public.What stays as set. The PLC directory, the
HANDLE_RESOLVERSservices, the addressesDID_WEB_HOSTSsets,DOMAIN_CHECK_ATand the other configured services are the operator's settings and are asked as they are set.DID_WEB_SCHEME=httpnow reaches adid:web's own host only from a host on http.Why
The resolver fetched a
did:web's document from whatever host the DID names and a handle's/.well-known/atproto-didfrom whatever name, and the host then called whatever PDS the document named, all with the plain client (redirects followed for PDS calls, any address). Anyone controlling adid:webor a handle could point the host at its own network (a cloud metadata service, an admin port). grain already guards this the same way (https only, public addresses only, no redirects, local only when configured); this applies those rules here and keeps the shape grain has (guard.rs), so both can later move to a shared crate.The "explicit configuration" for local networks is the one this host already had:
PUBLIC_URLon http. Client metadata, syncer endpoints, app logos and the service proxy were already held to it, anddocs/design/signing-in.mdalready said so; a second switch would have been a second convention for the same thing. The e2e harness runs the host onhttp://localhost:<port>, so it reaches the reference PDS as before.How it was checked
tests/identity.rs:knows_a_public_address(moved fromtests/oauth_clients.rs, with NAT64, IPv4-compatible, site-local and discard-prefix cases);asks_a_host_others_name_only_on_https_at_a_public_address(public IPs allowed; loopback, private, link-local,localhostrefused; http refused; anything allowed withhttp_here);asks_no_did_web_or_handle_that_points_inward(a host on https refuses a did:web at 127.0.0.1, atlocalhost, over http, and a handle's well-known on either scheme;DID_WEB_HOSTSread as set; a host on http reads both);follows_no_redirect_and_reads_no_more_than_a_documentnow counts hits on the redirect target, for a did:web and a handle, and asserts none.tests/spaces.rs:tells_no_authority_whose_pds_is_not_at_a_public_address, a host on https leaving a PDS on this machine untold and the notice still owed.tests/domain.rs:a_domain_pointing_inward_is_not_asked, for a host on https and on http.https://host.testreached PDSes on this machine now run onhttp://host.test(spaces, authority, index, invites, members, interop's space test), asauthority.rsandgroup_spaces.rstests already did.Shortcomings
DID_WEB_SCHEME=httpon a host on https now reads nodid:web's own host. Only test networks set it.