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

Apps sign in to a group with app passwords its members make

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

What changes

App passwords (app_passwords.rs). An app that signs in with a handle and a password, as the Bluesky app does, signs in to a group with an app password.

A group has no password, and an app password doesn't give it one. A member who may do anything as the group (every repo collection) makes one in the console with createAppPassword, named for where it's used, and it stays theirs.

  • It is shown once. The host keeps only its SHA-256: it is 80 random bits, so a slow hash would make it no harder to guess.
  • A group holds 25 at most.
  • listAppPasswords shows every one to the group's configurers, and each maker their own.
  • revokeAppPassword takes one away (its maker's own, or any for a configurer) and signs out every app signed in with it.

Sessions.

  • com.atproto.server.createSession signs in with one, by the group's handle or DID.
  • refreshSession gives a new pair of tokens and ends the old.
  • deleteSession signs out.

A session is a grant like any other, listed among the group's with source appPassword, and logged. Its tokens are bearer JWTs, as a PDS's are, because the Bluesky app reads when they lapse; the host still finds them by their hash. A lapsed access token is a 400 ExpiredToken, the app's sign to refresh. Its scope is atproto transition:generic, which reaches the group's repo and blobs but never a space; a privileged one adds transition:chat.bsky. The resource side now takes Bearer for these sessions alone: an OAuth token sent as Bearer is InvalidToken.

An app password works only while its maker could make it. The host asks at each use, sign-in and refresh. Once they couldn't (they lost the role, or left), every app password of theirs is forgotten and every session from one signed out.

From the sessions pull's review:

  • A role's writes in a space carry their actions when published in the group's repo: a role that may only add events there may only add them in the repo.
  • A write's log entry says what it was as it was made, so a put that creates is "created". A commit now hands back its writes as resolved.

Why

Step 6's fourth part: the way in for apps without OAuth. Provisioning comes next, and closes the step.

What changed from the prototype:

  • A lapsed token is known by the host's record of it, not the JWT's own exp.
  • getSession already answered for a token (the token pull), so it serves app-password sessions too.

How it was checked

tests/app_passwords.rs:

  • making one, and each refusal (no right, names, duplicates, the cap of 25);
  • listing, for configurers and for makers;
  • signing in by handle (any case, with @) or DID, and each wrong identifier or password;
  • what a session reaches, and that a space is out of reach;
  • getSession, the session in listGroupTokens, a privileged session's scope;
  • tokens of other kinds sent as Bearer;
  • a lapsed token;
  • refreshing, signing out, and a switched-off group;
  • the end of a maker's right, by losing the role and by leaving;
  • revoking, by a maker and by a configurer, and the log.

tests/group_tokens.rs gains publishes_only_as_the_role_may_write_in_the_space. tests/tokens.rs checks that an OAuth token sent as Bearer is refused.

These port appPasswords.test.ts. Every test passes here; CI runs the coverage gate.

Approved

This adds app passwords: a member who may do anything as the group makes one, and an app signs in with it through createSession, refreshSession and deleteSession. The sessions are Bearer JWTs that the host looks up by hash. I read all of app_passwords.rs, the store, scope, resource and write-path changes, and the migration. I did not read the tests, the docs or the lockfile, and I did not look at the checks.

I found nothing that must change.

  • Only the SHA-256 of a password is stored, and it is unique.
  • stands checks the maker at every use, in session, in refresh and at sign-in.
  • Revoking a password, or a maker losing the role or leaving, ends its sessions.
  • Refresh and getSession only accept grants whose source is appPassword.
  • An OAuth token sent as Bearer is refused, and an app-password session fails the DPoP key check.
  • generic() widens only the repo and blob checks. may_repo still checks the member's current roles, so the scope grants no more than the member already has.
  • The publish check now takes per-action writes from the space role, as the earlier review asked.
Merged as 864817f