Delete the runtime app registration surface (R7, fork 3)

registerApp minted a client_secret whose hash nothing ever verified (six
routes gate on the shared-secret caller-identity check, not on registration);
registered_apps sits empty on the live host. Deleted: POST /v1/apps,
getRegistrationSecret, config.appRegistrationSecret, registerApp/
hashClientSecret/verifyClientSecret, the client_secret_hash column (dropped
idempotently on startup, same as it is created), and
tests/app-registration-endpoint.test.ts. registered_apps and resolveAppProfile
stay as a profile store; app-registry.test.ts fixtures that used registerApp
purely to seed a profile now write through store.registerApp directly, the
same primitive the built-in-shadow test already used.
This commit is contained in:
Meta Vens 2026-09-08 13:21:18 +02:00
commit 776565effd
9 changed files with 45 additions and 376 deletions

View file

@ -63,7 +63,6 @@ export class InMemoryStore implements HeimdallStore {
managedConnectionProviders: [...input.managedConnectionProviders],
capabilities: structuredClone(input.capabilities),
redirectUris: [...input.redirectUris],
clientSecretHash: input.clientSecretHash,
};
this.registeredApps.set(record.slug, record);
return structuredClone(record);

View file

@ -75,7 +75,6 @@ interface RegisteredAppRow extends QueryResultRow {
managed_connection_providers: Provider[];
capabilities_json: CapabilityDefinition[];
redirect_uris: string[];
client_secret_hash: string | null;
}
interface SessionRow extends QueryResultRow {
@ -308,9 +307,9 @@ export class PostgresStore implements HeimdallStore {
INSERT INTO registered_apps (
slug, display_name, profile_version, created_at, updated_at,
identity_providers, entitlement_sources, managed_connection_providers,
capabilities_json, redirect_uris, client_secret_hash
capabilities_json, redirect_uris
)
VALUES ($1, $2, $3, $4, $4, $5, $6, $7, $8, $9, $10)
VALUES ($1, $2, $3, $4, $4, $5, $6, $7, $8, $9)
ON CONFLICT (slug)
DO UPDATE SET
display_name = EXCLUDED.display_name,
@ -320,8 +319,7 @@ export class PostgresStore implements HeimdallStore {
entitlement_sources = EXCLUDED.entitlement_sources,
managed_connection_providers = EXCLUDED.managed_connection_providers,
capabilities_json = EXCLUDED.capabilities_json,
redirect_uris = EXCLUDED.redirect_uris,
client_secret_hash = COALESCE(EXCLUDED.client_secret_hash, registered_apps.client_secret_hash)
redirect_uris = EXCLUDED.redirect_uris
RETURNING *
`,
[
@ -334,7 +332,6 @@ export class PostgresStore implements HeimdallStore {
JSON.stringify(input.managedConnectionProviders),
JSON.stringify(input.capabilities),
JSON.stringify(input.redirectUris),
input.clientSecretHash,
],
);
return mapRegisteredApp(result.rows[0]!);
@ -860,6 +857,5 @@ function mapRegisteredApp(row: RegisteredAppRow): StoredRegisteredApp {
managedConnectionProviders: row.managed_connection_providers,
capabilities: row.capabilities_json,
redirectUris: row.redirect_uris,
clientSecretHash: row.client_secret_hash,
};
}

View file

@ -9,10 +9,14 @@ CREATE TABLE IF NOT EXISTS registered_apps (
entitlement_sources JSONB NOT NULL,
managed_connection_providers JSONB NOT NULL,
capabilities_json JSONB NOT NULL,
redirect_uris JSONB NOT NULL,
client_secret_hash TEXT
redirect_uris JSONB NOT NULL
);
-- Runtime app registration (POST /v1/apps) minted a client_secret_hash that
-- nothing ever verified. Deleted with the caller-identity cut; drop the
-- column on any store built before this schema too.
ALTER TABLE registered_apps DROP COLUMN IF EXISTS client_secret_hash;
CREATE TABLE IF NOT EXISTS accounts (
id TEXT PRIMARY KEY,
created_at TIMESTAMPTZ NOT NULL,

View file

@ -11,8 +11,9 @@ import {
* An app registered at runtime.
*
* The built-in profiles are seed data of the same shape; nothing here is
* special-cased for them. clientSecretHash is stored rather than the secret,
* so a database read cannot impersonate a registered app.
* special-cased for them. There is no runtime registration authority anymore
* (deleted with the auth-hole cut: a minted client_secret nobody verified);
* this remains a profile store consulted by resolveAppProfile.
*/
export interface StoredRegisteredApp {
slug: string;
@ -25,7 +26,6 @@ export interface StoredRegisteredApp {
managedConnectionProviders: Provider[];
capabilities: CapabilityDefinition[];
redirectUris: string[];
clientSecretHash: string | null;
}
export interface RegisterAppInput {
@ -38,7 +38,6 @@ export interface RegisterAppInput {
managedConnectionProviders: Provider[];
capabilities: CapabilityDefinition[];
redirectUris: string[];
clientSecretHash: string | null;
}
export interface StoredAccount {