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

The console shows who is signed in, approves apps, and is tested end to end

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

What changes

Who is looking, and their groups (actors.rs).

  • getViewer, as knotless's: who is asking, by the console's cookie or service auth, with the handle their DID document names and whether the host lets them start a group; {} for no one. The console can't read the host's signed cookie itself, so only the host can say whom it names.
  • getActorGroups: the groups someone is in, every one of the caller's own and of anyone else's only those the caller is in too, a page at a time by DID, each with its handle, address, member count, and the name and picture the caller may read.

The console's pages.

  • The header shows who is signed in, with a sign-out button, or else the sign-in form.
  • Home lists "Your groups" above every group on the host.
  • /authorize, where the host sends an app's browser, shows the app's request: for each group the person may sign it in as, what it would get and what it would not, then approve or decline. Signed out, it asks them to sign in first, and comes back. A request answered or lapsed says so.

The console end to end (harness/e2e, just e2e, the e2e check), as knotless's harness does its pages. Setup runs the reference PDS, the host over it, and the built console behind an https front at console.group-host.internal (harness/tls-proxy.mjs, knotless's), since the PDS reaches an OAuth client only over https at a hostname; harness/pds.mjs makes that name's certificate and resolves it. A group of alice's is made with service auth from her PDS.

The flows, in Chromium:

  1. Signing in at her own PDS, through its own approval page.
  2. Seeing her groups.
  3. An app (a real loopback client with PKCE and DPoP, listening on a port of its own) signed in as her group through /oauth/authorize and the console's /authorize; then its code exchanged, and a post written as the group and read back from the host.
  4. An app declined.
  5. Coming to a request that has lapsed.
  6. Signing out.

What the flows found in the console, each fixed here:

  • A procedure's body was passed on to the host as a stream, which Node's fetch refuses: approving was a 500.
  • A redirect back to the app was refused by Kit (redirect_external_not_allowed).
  • A redirect from a form on https to an app listening on http, as every native app does, is the browser's to stop as an insecure form. So the action answers with where to go, and the page goes there (BackToApp), with a link without its script.
  • The page drawn after the form had lost its request_uri, and then found the request answered: the forms keep it in their address, and an answered request is the page's to say.

Why

Step 7's next part, and the first test of the console with a real PDS and browser, which the unit tests could not be: the sign-in at a person's own PDS and an app's approval only work end to end. Four of the five bugs above would have stopped every real approval.

How it was checked

  • tests/actors.rs: getViewer for no one, someone, and a host that would not let them start a group; getActorGroups for oneself, for another (only shared groups), a profile one may not read, pages, an unknown handle, no auth, and a group's picture.
  • just e2e: six flows, passing locally in nine seconds.
  • svelte-check, the layers and the build pass. Local coverage is 100% of lines and functions.
  • The e2e workflow is new: Chromium and its libraries cached as knotless's are, gated on the console, the host, the lexicons and the harness. Its first run is this pull's.

Shortcomings

  • The flows run over npm's stock PDS, not the spaces alpha, as nothing on the console's pages yet needs a space.
Approved

This pull adds getViewer and getActorGroups to the host. It adds a signed-in header, a "Your groups" list and an /authorize approval page to the console. It also adds a Playwright end-to-end harness that runs the console against a real PDS and the host. I read all 31 files except the harness/e2e sources, the host tests and the docs pages, which I did not open. I found nothing that must change.

  • get_actor_groups: The "only groups the caller is also in" filter applies to every actor, and for the caller's own DID it returns all of their groups. Paging is stable: groups are sorted by DID and the cursor is the last DID on the page. The name and picture appear only when the viewer can read the access record.
  • get_viewer: It returns {} for no one, and a failed DID-document lookup only drops the handle.
  • Console changes: The handleFetch fix buffers the body before forwarding it. The approve and decline forms keep request_uri in their address. BackToApp sends the browser on to the app, and its link works without script. The redirect URL comes from the host's own answer, so I saw no open-redirect problem.
  • Not verified: harness/pds.mjs now runs openssl and tls.setDefaultCACertificates (Node 24.5 or later) as soon as it loads, for every user of that file. If the test workflow also uses it, its image needs openssl. That is fine on rust:1.98 if it is the full image. Watch the first test and e2e runs for it.

All checks were still queued when I read the pull, so none had a result, including the new e2e check.

Merged as 9294a06