Files
orangecat/scripts/oauth/client-scopes-sql.ts
CatoandClaude 553d330843 feat(oauth): a client for every fleet sign-in page, given its secret on the box (#1523)
The owner's rule (2026-11-01): every fleet app offers every sign-in method,
"Continue with OrangeCat" included. Ten apps with a sign-in page had no
client: aoz-begleitung, biaslens, botsmann, diplodoctor, hirnli (on both
hosts), keller, kivvi, printcraft, reparaturbonus-zh and vitareba (vita and
vitareba hosts). They are now in client-specs.ts, identity-only.

Creating a client used to mean running register-client.ts on the box and
copying the printed secret by hand. Now the deploy's client SQL also creates a
missing row, switched off and with no secret: inert twice over (getClient
reads only enabled rows; verifyClientSecret rejects a null hash). loki
app-secrets.sh (kind oc-client, bitbaum/loki#1533) then writes the secret
into the app's env and its sha256 into the row, and switches it on, printing
neither. register-client.ts now mints a secret for such a row instead of
re-enabling it secretless.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 21:55:29 +01:00

15 lines
673 B
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.
*
* npx tsx scripts/oauth/client-scopes-sql.ts | psql …
*/
import { clientRowInserts, clientScopeUpdates } from './client-specs';
process.stdout.write(`${[...clientRowInserts(), ...clientScopeUpdates()].join('\n')}\n`);