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

The Apps page names apps by their metadata and says changes in words

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:console/apps-words

What changes

Apps acting as the group. Each app is named by its client metadata: its client_name, its icon (logo_uri), and the domain of its client ID beside the name (Grain next.grain.social), in place of a cut client ID (next.grain.social/oauth). Under the name, a line says what the app's scope lets it do. An app that writes gets "Can post and make changes as the group". An app that only reads gets what it reads and calls, for example "Can read the group's profile, members and pool, and see requests to join" for Grain's read-only client. Then comes who let it in: "Approved by @chadtmiller.com", "With an app password created by @bob.test", or "In the console, by …", each with when it was last used. Two clients of one app, as Grain has, are told apart by that line.

App icons. The host reads an app's icon and serves it at /img/app?id=<client ID>, which the console already proxies with /img/. The reader's browser never loads a third party's URL. The host fetches a logo_uri only when it is https (http only while the host itself is on http) on the client ID's own origin, with no userinfo or fragment. It fetches through Host::pinned, which reaches public addresses only and follows no redirect. It keeps the icon only when the answer succeeds, is 256 KiB at most, and its bytes start as a PNG, JPEG, GIF or WebP. SVG is never served, and the server's Content-Type is not trusted. The host keeps what it read for 10 minutes, misses too, for up to 100 clients. It serves the icon with nosniff, default-src 'none'; sandbox and private, max-age=600, and anything else is a 404. An app without an icon, or one that fails to load, is drawn as its initial on a square (Avatar app). getAuthorization's client.logo (and uri) are now given only when they pass the same check, and the approval screen shows the icon beside "<app> wants to sign in as one of your groups".

Changes made as the group. The third card was "What apps did as the group", but it also listed members' own changes from the console. It is now "Changes made as the group", with the intro "By apps, and by members in the console, newest first.", and every row says where its change came from: "Approved by @x" for an app, "App password created by @x" for an app password, and "In the console" for a member there.

  • Space changes are no longer said as changed a record of space at:space. write_of split updated space <uri> at its first /, so it parsed as a write of collection space at:space. Space log entries now come as space: {space, operation, publicRead?}. updateSpace logs opened space <uri> when it lets anyone read the space and closed space <uri> when it stops that. On the meta space those read "@x made the group members-only" and "@x made the group visible to anyone". On any other space, the space is named by what the group keeps there, never by its URI: "the group's profile", "the group's members", "the group's pool".
  • Another app's records read as a person would: "Grain (next.grain.social) created the group's Grain profile". The app is named by its client metadata with its domain. The record is named by its NSID's app and last part (social.grain.actor.profile → "Grain profile"), as "the group's …" for a self record and "a/an …" otherwise. Under the sentence goes its lexicon's description, where the host can resolve the lexicon: writeView.description, read over DNS-over-HTTPS as permission sets are, the two sharing one cached read of a lexicon.

org.atgrp.internal.listGroupTokens grows #clientView (sessionView.client, activityView.client), #spaceView (activityView.space) and writeView.description, all optional.

The pictures below the body, in order: the Apps tab before (main, with the test world's Darkroom in place of production's two Grain clients), the approval page before, then after: the Apps tab desktop light and phone dark, and the approval page desktop light and phone dark.

Why

People running a group couldn't tell what an app was, what it could do, or what a log line meant. The facts were on the host already (client metadata, the scope, the space and its policy, other apps' lexicons), so the host now hands them over in parts and the console says them in words.

The icon is proxied rather than loaded from logo_uri. The reference provider (@atproto/oauth-provider-ui, client-avatar.tsx) shows logo_uri only for clients its operator marks trusted, loads it in the browser under img-src https:, and carries a TODO to proxy instead. This host has no trusted list. Proxying keeps the reader's browser from contacting an app's server, and lets the host check and cap what it serves.

For the card's heading, I chose to retitle it over marking console rows alone. The card is the group's audit of what was done as it, and a member's change in the console is part of that.

How it was checked

  • Host: tests/oauth_clients.rs covers a metadata client through getAuthorization, listGroupTokens and /img/app: every 404 case, the cache expiring and clearing, and unit tests of the origin check and the image sniffing. tests/proxy.rs covers lexicon descriptions over a fake DNS-over-HTTPS and PDS. tests/group_spaces.rs covers the opened, closed and updated log words. Tests now point DNS_OVER_HTTPS at a closed port, so none reaches the internet. just t on these passes, and fmt, clippy, just lex and just docs are clean.
  • just cov passes the 100% gate for every group-host file. Locally it missed only crates/atgrp/src/lib.rs's account import lines, whose one test returns early on a PDS without the space alpha; CI runs it with the alpha.
  • Console: svelte-check, layers, strings and dialogs pass. just look drew the Apps tab and the approval page for both apps, desktop light and phone dark, and a fresh agent critiqued them. I acted on its notes on "made by" (now "created by"), on "records", and on the card's title. Its notes on the approval page's layout are about what was there before.
  • The look and e2e worlds now have apps on the web, harness/oauth-app.mjs: Darkroom, with an icon, which writes its own profile for the group on sign-in, and Darkroom's read-only client, which has no icon. They also get a DNS-over-HTTPS of their own, so nothing asks the internet. apps:/… look lines open those apps. The e2e App now shares OAuthClient with them. The new seed nightshift-oauth approves both clients through the console and makes Night shift members-only.
  • docs/guides/signing-in-as-a-group.md has a new section on approving an app, and just shots drew its pictures again. docs/design/signing-in.md and docs/reference/api.md say the new route and fields.

Shortcomings

  • Log entries written before this land keep updated space <uri>, which never said what changed. They read "@x changed who sees the group's profile", not "made the group members-only". New ones say which.
  • The test world resolves no other app's lexicon, so the description line under another app's record is covered by the host's tests but not drawn in the pictures.
  • A client whose metadata fails to load isn't cached as a miss (Host::client keeps successes only). A hanging metadata server can add up to the 10 s outgoing timeout to the Apps page.
  • client.uri on the approval page is also given only on the client ID's origin. It is narrower than before, and keeps an app from showing another site as its home page.
  • The domain shown is the client ID's hostname, without a port.

Review

The design of listGroupTokens' new fields, then crates/group-host/src/apps.rs (the icon check and proxy) and web/src/lib/activity.ts (the sentences).

before-apps.png

before-consent.png

after-apps.png

after-apps-phone-dark.png

after-consent.png

after-consent-phone-dark.png

Approved

This names apps by their client metadata and serves their icons through the host at /img/app. It also says each change made as the group in words, and listGroupTokens gains optional client, space and description parts.

I read apps.rs, group_tokens.rs, permission_sets.rs, authorization.rs, group_spaces.rs, lib.rs and activity.ts in full. I did not open the harness, docs, screenshots, tests or the other Svelte, CSS and message files. I found nothing that must change.

  • Icon check: the same-origin, https and no-userinfo/fragment rules, Host::pinned with no redirect, the 256 KiB cap, and the magic-byte sniff with SVG never served all hold. The response headers (nosniff, a sandboxing CSP) are sound.
  • write_of fix: filtering the collection with is_nsid stops space at:space parsing as a write. The new space_of log words are handled apart from writes.
  • Open endpoint: /img/app?id= is unauthenticated, and each new id makes the host fetch that client's metadata. Logos caches misses, but only up to 100 entries before it clears everything. A caller can therefore keep triggering outbound fetches by rotating ids. Pinned addresses and the size cap bound the harm. If you see abuse, consider a per-IP limit or a cap on in-flight fetches.
Merged as cb4a8cd