~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

Apps make groups for people and leave with a session on them

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:host/provision

What changes

Provisioning (provision.rs, provisionGroup). An app makes a group for someone and leaves with its own session on it. Two parties sign in:

  • the person, with service auth from their own PDS, who becomes the founder;
  • the app, as at the token endpoint: its client id (and its assertion, if confidential) in the body, and a DPoP proof in the header.

The app must be one this host makes groups for: PROVISIONING_CLIENTS, comma-separated client ids or *, none by default. Its scope must hold atproto and nothing its metadata doesn't declare (InvalidScope). All of that is checked before the group is made.

The session is issued as a code exchange issues one, narrowed to the founder's roles as an approval is, and recorded as the founder's. From then on it is an ordinary grant: refreshed at /oauth/token, listed among the group's with source provisionGroup, and revoked there.

The token endpoint's issuing is now shared with provisioning (issue_grant, new_tokens, token_response), and createGroup's body is read by one function both use (new_group).

Why

Step 6's last part: an app can set up a group for someone in one step. With it, step 6 (signing in) is done.

What changed from the prototype:

  • The app's scope is narrowed to the founder's roles, as any approval is. The prototype gave it the scope as asked, on the grounds that a founder is an admin. Here a method of this host's own, which a member calls as themselves, is withheld as it is everywhere else.
  • A DPoP proof here needs the server's nonce, as at the token endpoint; the prototype took one without.

How it was checked

tests/provision.rs:

  • a group made, its founder, and the session writing, refreshing and listed as the founder's;
  • refusals that make nothing: an untrusted app, an unreadable client id, a public client sending an assertion, no clientId, no service auth, no proof;
  • the scope: without atproto, undeclared, and narrowed;
  • a taken handle.

tests/config.rs reads PROVISIONING_CLIENTS. These port provision.test.ts. Local coverage is 100% of lines and functions.

Approved

This adds provisionGroup. The founder signs in with service auth. The app signs in with its client id (and its assertion, if confidential) and a DPoP proof. The trusted-client list and the scope are checked, the group is made, and a session narrowed to the founder's roles is issued as an ordinary grant. The token-issuing code is shared with the token endpoint, and new_group is shared with createGroup. The extraction in oauth.rs keeps the behaviour of the code exchange.

I found nothing that must change. The checks are done in a sensible order, and the lexicon, config reference, design docs and tests all come with it. I did not read the checks' output.

One small point: the "checked before the group is made" claim does not cover roles, narrow and issue_grant, which run after create_group. If one of them fails with an internal error, the group exists and the caller gets an error with no session. The founder can still use the group, so this is tolerable, but you could note it in the docs or add cleanup later.

Merged as 7de0fbe