diff --git a/.env.example b/.env.example index 9b1ba8b..8d91415 100644 --- a/.env.example +++ b/.env.example @@ -10,7 +10,6 @@ GC_ACCESS_APPLY_SCHEMA_ON_STARTUP=1 GC_ACCESS_SESSION_TTL_SECONDS=3600 GC_ACCESS_STATE_TTL_SECONDS=600 GC_ACCESS_COMPLETION_TTL_SECONDS=300 -GC_ACCESS_SIGNING_PRIVATE_KEY_PEM= GC_ACCESS_SIGNING_PRIVATE_KEY_PATH= GC_ACCESS_SIGNING_PRIVATE_KEY_BOOTSTRAP=0 GC_ACCESS_SIGNING_KEY_ID= diff --git a/docs/architecture.md b/docs/architecture.md index 5f290af..ed1abc4 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -578,7 +578,6 @@ Suggested generic env surface: - `GC_ACCESS_BASE_URL=https://heimdall.gamecult.org` - `GC_ACCESS_INTERNAL_URL=http://127.0.0.1:4100` - `GC_ACCESS_SESSION_SECRET=...` -- `GC_ACCESS_SIGNING_PRIVATE_KEY_PEM=...` - `GC_ACCESS_SIGNING_PRIVATE_KEY_PATH=/var/lib/heimdall/signing-key.pem` - `GC_ACCESS_SIGNING_PRIVATE_KEY_BOOTSTRAP=1` - `GC_ACCESS_SIGNING_KEY_ID=...` @@ -604,10 +603,9 @@ Suggested generic env surface: Only configure the providers Heimdall actually owns for a given deployment. -If `GC_ACCESS_SIGNING_PRIVATE_KEY_PEM` is absent, the current skeleton falls -back to `GC_ACCESS_SIGNING_PRIVATE_KEY_PATH` if present, and can bootstrap that -file on first boot when `GC_ACCESS_SIGNING_PRIVATE_KEY_BOOTSTRAP=1`. If -neither PEM nor path is configured, the current skeleton falls back to an +The signing key is always a file: `GC_ACCESS_SIGNING_PRIVATE_KEY_PATH` names +it, and Heimdall can bootstrap that file on first boot when +`GC_ACCESS_SIGNING_PRIVATE_KEY_BOOTSTRAP=1`. If no path is configured, the current skeleton falls back to an ephemeral dev signing key. That is acceptable for local iteration and absolutely not acceptable for real deployment. diff --git a/docs/service-contract.md b/docs/service-contract.md index 54df1a9..68eb6a5 100644 --- a/docs/service-contract.md +++ b/docs/service-contract.md @@ -44,12 +44,11 @@ Purpose: Notes: - current skeleton signs with Ed25519 -- `GC_ACCESS_SIGNING_PRIVATE_KEY_PEM` still works for direct secret injection - `GC_ACCESS_SIGNING_PRIVATE_KEY_PATH` lets the service load a persisted key from disk - if the path is missing and `GC_ACCESS_SIGNING_PRIVATE_KEY_BOOTSTRAP=1`, the service bootstraps a new key file on first start -- if neither PEM nor path is configured, the service still generates an +- if no path is configured, the service still generates an ephemeral dev key at startup and deserves no sympathy when the `kid` changes ### `GET /.well-known/heimdall-configuration` diff --git a/src/config.ts b/src/config.ts index c60b96a..58e5269 100644 --- a/src/config.ts +++ b/src/config.ts @@ -35,7 +35,6 @@ export interface HeimdallConfig { refreshTtlSeconds: number; stateTtlSeconds: number; completionTtlSeconds: number; - signingPrivateKeyPem?: string; signingPrivateKeyPath?: string; bootstrapSigningPrivateKeyOnMissing: boolean; signingKeyId?: string; @@ -278,11 +277,6 @@ export function loadConfig( config.odinCultMeshUri = odinCultMeshUri; } - const signingPrivateKeyPem = env.GC_ACCESS_SIGNING_PRIVATE_KEY_PEM?.replace(/\\n/g, "\n"); - if (signingPrivateKeyPem) { - config.signingPrivateKeyPem = signingPrivateKeyPem; - } - if (env.GC_ACCESS_SIGNING_PRIVATE_KEY_PATH) { config.signingPrivateKeyPath = env.GC_ACCESS_SIGNING_PRIVATE_KEY_PATH; } diff --git a/src/signing.ts b/src/signing.ts index 72a5728..1a41a97 100644 --- a/src/signing.ts +++ b/src/signing.ts @@ -26,7 +26,7 @@ export interface RuntimeKeyMaterial { privateKey: KeyObject; publicKey: KeyObject; publicJwk: PublicSigningJwk; - source: "configured_pem" | "configured_file" | "bootstrapped_file" | "ephemeral_dev"; + source: "configured_file" | "bootstrapped_file" | "ephemeral_dev"; } function encodeBase64Url(input: string | Buffer): string { @@ -110,12 +110,7 @@ function createOrLoadPrivateKeyFromPath(config: HeimdallConfig): { } export function createRuntimeKeyMaterial(config: HeimdallConfig): RuntimeKeyMaterial { - const loaded = config.signingPrivateKeyPem - ? { - privateKey: createPrivateKey(config.signingPrivateKeyPem), - source: "configured_pem" as const, - } - : createOrLoadPrivateKeyFromPath(config); + const loaded = createOrLoadPrivateKeyFromPath(config); const privateKey = loaded.privateKey; const publicKey = createPublicKey(privateKey); const exportedJwk = publicKey.export({ format: "jwk" }) as Jwk;