Files
orangecat/scripts/oauth/client-scopes-sql.ts
a6878ff0cc fix(oauth): a client's origins are accepted from the next deploy; Heidi on fragheidi.ch (#1871)
* fix(oauth): a client's origins are accepted from the next deploy; Heidi on fragheidi.ch

Redirect URIs match exactly, and an origin added to client-specs.ts reached an
existing row only through a hand-written migration per app or a script run by
hand on the box. Heidi went live on fragheidi.ch with neither, so every
OrangeCat sign-in from there was refused.

The deploy-time refresh now also adds, for each origin in a spec, the shared
callback path and every path the row already accepts on another of the spec's
origins. It adds and never removes. Heidi lists fragheidi.ch.

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

* ci: re-run forge/verify (unrelated timing flake in planner/calendar-files.test.ts: ticks 5 vs >5 under load)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Developer Heidi <heidi@orangecat.ch>
2026-12-03 18:44:58 +01:00

30 lines
1.0 KiB
TypeScript

/**
* Print the SQL that brings the registered clients in line with
* scripts/oauth/client-specs.ts. The deploy pipes it through the box's psql
* right after the migrations (scripts/deploy-selfhost.sh), so a scope widened
* in the code is live with the code. A client with no row yet gets one,
* switched off and without a secret (clientRowInserts): it signs nobody in
* until loki app-secrets.sh or register-client.ts gives it a secret. The
* privacy and terms links the consent screen shows are refreshed the same way,
* and an origin added to a spec is accepted as a redirect from that deploy on
* (clientRedirectAdditions: it adds, it never removes).
*
* npx tsx scripts/oauth/client-scopes-sql.ts | psql …
*/
import {
clientDocumentUpdates,
clientRedirectAdditions,
clientRowInserts,
clientScopeUpdates,
} from './client-specs';
process.stdout.write(
`${[
...clientRowInserts(),
...clientScopeUpdates(),
...clientRedirectAdditions(),
...clientDocumentUpdates(),
].join('\n')}\n`
);