From 1fd240a58d336071cd69adfb5bee2c010d81273c Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 3 Dec 2026 21:31:04 +0100 Subject: [PATCH] Address Soul Lows: pin CORE_TABLES to CREATE_SCHEMA_SQL and remove stale doc refs --- .env.example | 1 - README.md | 13 +++++-------- docs/architecture.md | 5 ++--- docs/service-contract.md | 16 +++++----------- tests/store.test.ts | 5 +++++ 5 files changed, 17 insertions(+), 23 deletions(-) diff --git a/.env.example b/.env.example index 6af5d90..09f05d8 100644 --- a/.env.example +++ b/.env.example @@ -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 diff --git a/README.md b/README.md index f0e0a0e..3104ddd 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docs/architecture.md b/docs/architecture.md index 956b1db..16ea243 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -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 diff --git a/docs/service-contract.md b/docs/service-contract.md index 6915c6e..a1c2446 100644 --- a/docs/service-contract.md +++ b/docs/service-contract.md @@ -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: diff --git a/tests/store.test.ts b/tests/store.test.ts index cba35c3..fda8a9f 100644 --- a/tests/store.test.ts +++ b/tests/store.test.ts @@ -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 () => {