Files
CatoandClaude Fable 5.1 2077bfc207 feat(auth,docs): developer page for "Sign in with OrangeCat"; passkeys (#1185)
* feat(docs): developer page for "Sign in with OrangeCat" + round-trip script

Step D9 of ADR-0009. OrangeCat has been a real OpenID Connect provider
since June and five relying parties sign people in through it, but a site
that wanted the button had the standard and nothing else.

/docs/sign-in-with-orangecat: what you get (one identity keyed by sub,
passwords optional, people can disconnect you), self-service registration
with its rules, the Auth.js config Solon/Heidi/Loki run and the by-hand
authorize/token/userinfo/refresh calls, button wording (prompt=create,
login_hint), sessions and what invalid_grant means, and every scope with
its consent-screen wording. Every URL, scope and lifetime is derived from
the provider's own config (snippets.ts), and a unit test pins the snippets
to the discovery document, so the page cannot quote an endpoint the server
does not serve.

scripts/oauth/sign-in-roundtrip.mjs registers a client, opens the sign-in,
catches the code on loopback, exchanges it with PKCE, checks iss/aud/nonce,
reads userinfo, refreshes, and proves the spent token is refused — the
same steps any relying party takes, runnable before writing a line.

Linked from /docs. ADR-0009 status updated: D1–D4 shipped, relying parties
now honour revocation (solon#203, heidi#145).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QDMxjTqKNLXETMYYuapMa3

* fix(docs): userinfo snippet uses a shell variable for the token

gitleaks (curl-auth-header) reads 'Bearer THE_ACCESS_TOKEN' as a leaked
token; $ACCESS_TOKEN is what a person would paste anyway.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QDMxjTqKNLXETMYYuapMa3

* chore(security): allowlist the docs bearer-token placeholder for gitleaks

The developer page's userinfo example used 'Bearer THE_ACCESS_TOKEN', which
gitleaks' curl-auth-header rule reads as a leak. The tree now uses a shell
variable; the placeholder in history is allowlisted instead of rewriting it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QDMxjTqKNLXETMYYuapMa3

* feat(auth): passkeys — add/list/remove in settings, sign in with a passkey

Step D5 of ADR-0009. The self-hosted auth server (GoTrue) supports WebAuthn
passkeys and the browser client already carries the ceremony; what was
missing was the UI, the wrapper, and the switch.

- Settings → Security → Passkeys: the person's passkeys with name, date and
  last use; "Add a passkey" (browser prompt, then named); remove.
- /auth: "Sign in with a passkey" beside the emailed code — nothing typed.
- Both are hidden until the auth server reports passkeys_enabled: true
  (lib/auth/passkeys-availability reads GoTrue's public settings, cached
  five minutes, fails closed). A button that cannot work is a dead end.
- docs/operations/passkeys.md is the switch: GOTRUE_PASSKEY_ENABLED and the
  relying-party id/origins, with why the id is orangecat.ch and not the
  API host. scripts/auth/passkeys-e2e.mjs drives add → sign in → remove
  with Chromium's virtual authenticator and exits 2 while the switch is off.

services/supabase/auth/passkeys.ts wraps registerPasskey / passkey.list /
update / delete / signInWithPasskey in the auth service's shape; a passkey
is named in a second call and a failed rename still returns a working key.
Unit tests cover the availability parser and the wrappers.

Also: the two CLI scripts under scripts/ carry the no-console pragma their
siblings use.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QDMxjTqKNLXETMYYuapMa3

* fix(scripts): throwaway inbox password from crypto.randomBytes

CodeQL (js/insecure-randomness) flags Math.random() for a password, even
a disposable one; the real generator costs nothing.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QDMxjTqKNLXETMYYuapMa3

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-29 02:45:52 -07:00
..