Address Soul Lows: pin CORE_TABLES to CREATE_SCHEMA_SQL and remove stale doc refs

This commit is contained in:
Meta Vens 2026-12-03 21:31:04 +01:00
commit 1fd240a58d
5 changed files with 17 additions and 23 deletions

View file

@ -30,6 +30,5 @@ GC_ACCESS_PROVIDER_YOUTUBE_CLIENT_ID=
GC_ACCESS_PROVIDER_SPOTIFY_CLIENT_ID=
# GC_ACCESS_PROVIDER_SPOTIFY_CLIENT_SECRET_FILE=/absolute/path/to/credential
GC_ACCESS_APP_SPOTIVERSE_BACKEND_CALLBACK_URLS=
# GC_ACCESS_APP_GHOSTLIGHT_SHARED_SECRET_FILE=/absolute/path/to/credential
GC_ACCESS_APP_GHOSTLIGHT_RUNTIME_IDS=yggdrasil-ghostlight

View file

@ -18,7 +18,6 @@ The point is painfully simple:
- **Problem:** every GameCult app was rebuilding Discord/Patreon login glue. Heimdall centralizes identity authority and keeps app-domain data in the apps.
- **Entry points:**
- `src/index.ts` and `src/app.ts`: the Fastify service. `src/signing.ts` and `src/claims.ts` issue JWTs and serve `/.well-known/jwks.json`; `src/oauth.ts` and `src/providers.ts` own provider flows.
- `src/verifier.ts`: the local verifier helper an app backend imports to validate Heimdall JWTs without phoning home.
- `src/odin-publication.ts` and `plugins/gamecult.heimdall.access`: the redacted Odin/Eve provider advertisement and the `gamecult.heimdall.access` plugin (`docs/eve-access-plugin.md`).
- `docs/architecture.md`, `docs/service-contract.md`, `docs/verse-service-contract.md`, `docs/app-profiles/`: the contracts.
- `pnpm install`, `pnpm dev`, `pnpm test` (see Dev Commands).
@ -47,10 +46,8 @@ Landed right now:
- AES-256-GCM sealing for managed provider tokens at rest
- a one-time browser completion exchange kept as fallback for opener
`postMessage` handoff
- app profile surfaces for Repixelizer, StreamPixels, and Spotiverse
- signed claim issuance for app-local verification experiments
- a local verifier helper in `src/verifier.ts` so app backends can validate
Heimdall JWTs without phoning home on every guarded request
- app profile surfaces for Repixelizer, StreamPixels, Bifrost, and Ghostlight
- signed claim issuance for app-local verification against `/.well-known/jwks.json`
- a read-only Odin/Eve provider advertisement export that names redacted
CultCache witness document shapes and paths without touching live secrets
- a daemon-owned CultCache boundary witness at `GC_ACCESS_CULTCACHE_PATH`
@ -84,9 +81,9 @@ Canonical docs:
- `docs/verse-service-contract.md`
- `docs/app-profiles/repixelizer.md`
- `docs/app-profiles/streampixels.md`
- `docs/app-profiles/spotiverse.md`
- `state/map.yaml`
- `notes/fresh-workspace-handoff.md`
- `docs/app-profiles/bifrost.md`
- `docs/app-profiles/ghostlight.md`
- `docs/app-profiles/spotiverse.md` (retired restore spec)
## Dev Commands

View file

@ -374,10 +374,9 @@ for: only a strong proof whose method the profile lists as an account proof
covers the whole account; any other proof covers the one login in
`auth_identity_id`. The
asserted route trusts the calling app and is bounded by the app secret, a live
bearer for that app, the method allowlist, a nonce claimed once per session
bearer for that app, the method allowlist, and a nonce claimed once per session
through `claimOAuthStateUse` (phase `step_up_assert`, no new table or grant;
retained to the session expiry as of the claim, which a refresh may slide past),
and in-process fixed-window limits (`src/fixed-window.ts`).
retained to the session expiry as of the claim, which a refresh may slide past).
### Three nested guards

View file

@ -912,27 +912,21 @@ Important behavior:
- app-local binding, diagnostics, subscription setup, and runtime behavior stay
app-owned
### Reference local verifier seam
### Local verification seam
Purpose:
- give app backends a tiny local verification helper instead of encouraging
per-request Heimdall callbacks
- let app backends verify Heimdall Ed25519 JWTs locally against `/.well-known/jwks.json`
instead of calling Heimdall on every guarded request
Current reference helper:
Expected verifier contract:
- `src/verifier.ts`
Current helper contract:
- build the verifier once from Heimdall `issuer`, app slug, and JWKS
- fetch and cache Heimdall's JWKS by `kid`, bound to Heimdall `issuer` and app slug
- verify Ed25519 signature locally by `kid`
- reject wrong `iss`, wrong `aud`, malformed claim shape, `nbf` violations,
and expired tokens
- accept a small clock-skew window for normal same-host reality
This is a reference seam, not a magical shared middleware product yet.
## Access claim shape
Current claim payload fields:

View file

@ -475,6 +475,11 @@ describe("PostgresStore.checkSchema", () => {
expect(queries[0]!.sql).toBe("SELECT 1");
expect(queries[1]!.sql).toContain("to_regclass('public.' || name) IS NULL");
expect(queries[1]!.params).toEqual([CORE_TABLES]);
const declaredTables = Array.from(
CREATE_SCHEMA_SQL.matchAll(/CREATE TABLE IF NOT EXISTS (\w+)/g),
(m) => m[1]!,
);
expect([...CORE_TABLES].sort()).toEqual([...declaredTables].sort());
});
it("throws SCHEMA_MISSING when any core table is missing", async () => {