chadtmiller.com/group-host
atmosphere group host
Scopes are read in every form atproto writes them
MergedThe pull reads percent-escapes in scopes at sign-in and at use. It also lets narrowing keep repo?collection=… and blob?accept=… scopes. I found one small bug and no blockers. I haven't seen the check results and didn't run the tests.
Escapes that shape a scope (%, &, =, ?) are left as written. Narrowing keeps a repo scope only when the roles write every collection it names. An empty collection list is refused rather than kept as "everything".
One thing to fix: in decoded, u8::from_str_radix accepts a leading +. So a malformed escape such as %+f is decoded to byte 0x0f instead of being left as written. Your tests cover %zz and a cut-off %4, but not this. Checking that both characters are ASCII hex digits closes it. The effect is small, since it only turns garbage into a control character, but it contradicts the "bad escape stays as written" claim.
crates/group-host/src/scopes.rsline 27Outdated
These lines can no longer be read.
from_str_radix("+f", 16) returns Ok(15), so %+f is decoded rather than left as written. Require h.bytes().all(|b| b.is_ascii_hexdigit()) first.
What changes
Escaped values. A scope's query values were compared as written, so
space:…?authority=did%3Aplc%3Aabc, asURLSearchParamswrites it, was withheld at sign-in and would not have matched at use.scopes::decodedreads each escape before a scope is parsed, at sign-in (SpaceScope::parse) and at use (Permissions::new), but leaves an escape of what shapes a scope (%,&,=,?) as written, so it cannot split a value. Fixes at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzjdcyrntyj6.Collections and file types by query. Narrowing kept a repo scope only as
repo:Cand a blob scope only asblob:…, thoughrepo?collection=C&collection=Dandblob?accept=…are as valid, and the host honours them at use. It now reads a repo scope's collections either way (scopes::repo_collections), keeping it when the roles write every one, and takesblob?as it takesblob:. Fixes at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzjdd2hdwbli.How it was checked
reads_every_form_a_scope_may_take(oauth_scope), failing before the change: an admin keeps both query forms, ablob?accept=scope and an escaped authority; a poster keeps the one whose collections they all write.reads_a_scope_as_atproto_has_it(tokens) reads an escaped authority and collection at use, and leaves an escaped&and=, a bad escape and a cut-off one as written. The scope, token, OAuth, authorization and app password tests pass; clippy is clean.🤖 Generated with Claude Code