chadtmiller.com/group-host
atmosphere group host
Members take group tokens, configurers see and end every grant
MergedThis adds getGroupAuth, listGroupTokens and revokeGroupToken. It records each grant's source and last use, and keeps an activity log. It also moves every swap, create-or-update, scope and no-op check into repo::resolve, run under the write lock. I read group_tokens.rs, repo.rs and token_writes.rs in full. I did not read oauth_store.rs, oauth.rs, oauth_resource.rs, space.rs, store.rs, lib.rs, the tests or the docs. check passes; test was still running when I looked, so I haven't seen the coverage gate pass.
The change reads as correct. The authorization runs inside the lock, and swapCommit is checked before the paths are read. A put of what is already there still goes through allow before it is dropped as a no-op. Revoke checks g.group == group, so a configurer can't end another group's grant.
Two non-blocking points:
publishablereturns only collection names and drops the actions fromwrites_for. For a group token this is fine, becausescopes_forlimits the actions in the token. For an OAuth grant with a broaderrepo:scope, a role that may only create in a space could also update or delete that collection in the repo. If the lexicon means "publish what it writes", you may want to carry the actions through.- The log can say the wrong thing about a put.
put_or_deleteandspace_writespass the original write towrote. A put is always built as anUpdate, so a put that creates a record is logged as "updated". Logging the resolved writes would fix it, butresolvedoesn't return them fromwrite_asked.
crates/group-host/src/group_tokens.rsline 70
let access = self.group_record(group, uri, &format!("{NS}.access"), "self"); | |
let access = access.map_err(XrpcError::internal)?.unwrap_or_default(); | |
if Access::of(&access).people.is_none() { | |
out.extend(writes_for(&access, roles).into_keys()); |
writes_for(...).into_keys() discards the actions, and may_repo then allows any action on those collections in the repo. A role that may only create in a space could update or delete the same collection in the repo, for any grant whose scope is broad enough. Group tokens are safe because scopes_for limits the actions; OAuth grants are not.
crates/group-host/src/token_writes.rsline 349
let mut out = json!({}); | |
if let Some(c) = &committed { | |
out["commit"] = commit_view(c); | |
host.wrote(&acting, None, std::slice::from_ref(&write))?; |
write is the unresolved Update that one builds, so a put that created the record is logged as "updated". The same happens in space_writes.
This round adds two commits, and both only restructure oauth_store.rs. record_activity now binds its parameters before running the insert. The activity row mapping is now a named activity function. Neither commit changes behaviour. The check and web workflows pass or were skipped, and test was still running when I looked, so I haven't seen the coverage gate pass.
My two earlier points were non-blocking and are still open:
publishabledrops the actions fromwrites_for. Group tokens are safe becausescopes_forlimits their actions, but an OAuth grant with a broadrepo:scope could update or delete in the repo where the role may only create in a space.- A put that creates a record is still logged as "updated", because
wrotereceives the unresolvedUpdate.
I'd fix both, but neither blocks the merge.
What changes
Group tokens (
group_tokens.rs,getGroupAuth). A member signed in to the console asks with their own service auth and a DPoP proof, and gets a token for the group. It lasts fifteen minutes, is bound to that key, and is never refreshed. Its scope is what the member's roles may write as the group in the one space they asked for, by its access record'scredentialScopes:Where their roles write nothing, there is no token (
Forbidden).A role may publish what it writes as the group in a space. The access lexicon says so. So a token's writes to the group's repo are now also allowed for the kinds of record the member's roles write in any of the group's spaces (
Host::publishable), beside what the permissions record grants.Who acts as the group. Each grant now records how it was given (
oauthorgetGroupAuth) and when it was last used, to the minute. The group keeps a log of each sign-in, each token taken, each record a grant writes, and each grant ended.listGroupTokensshows the group's configurers every grant that still lasts, with the latest twenty entries of the log, andrevokeGroupTokenends one.Everything a write asks of the repo is asked as it is written, under the lock its commit is made under (
repo::resolve, shared by the group's repo and its spaces). That covers:swapCommit, andswapRecord;This answers both of the token pull's non-blocking review points. A put of what is there already, or a delete of what isn't, is asked of the scope as any other write and only then makes no commit. Two writes that swap the same commit cannot both land.
Why
Step 6's third part: the console's way to act as the group, and a group's way to see and end what acts as it. App passwords come next, then provisioning.
What changed from the prototype:
*, without resolving the records' lexicons for their file fields.listConnectedApps, for AI assistants, comes with the MCP server (step 9).How it was checked
tests/group_tokens.rs:tests/tokens.rsgainsasks_everything_of_the_repo_as_it_is_when_written:swapCommit;These port
groupAuth.test.tsandconnectedApps.test.ts. Every test passes here, interop included; CI runs the coverage gate.