{"record":{"id":"6a2b1a5f279a7fe7","repo":"diegosouzapw/OmniRoute","slug":"api-key-secret-is-required-for-api-key-crc-operati","errorCode":null,"errorMessage":"API_KEY_SECRET is required for API key CRC operations. The startup validator (instrumentation-node.ts) should have set this automatically.","messagePattern":"API_KEY_SECRET is required for API key CRC operations\\. The startup validator \\(instrumentation-node\\.ts\\) should have set this automatically\\.","errorType":"panic","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/shared/utils/apiKey.ts","lineNumber":11,"sourceCode":"import crypto from \"crypto\";\n\n// FASE-01: No hardcoded fallback — enforced by secretsValidator at startup\nif (!process.env.API_KEY_SECRET) {\n  console.error(\"[SECURITY] API_KEY_SECRET is not set. API key CRC validation is disabled.\");\n}\n\nfunction getApiKeySecret(): string {\n  const secret = process.env.API_KEY_SECRET;\n  if (!secret || secret.trim() === \"\") {\n    throw new Error(\n      \"API_KEY_SECRET is required for API key CRC operations. \" +\n        \"The startup validator (instrumentation-node.ts) should have set this automatically.\"\n    );\n  }\n  return secret;\n}\n\n/**\n * Generate 6-char random keyId\n */\nfunction generateKeyId(): string {\n  const chars = \"abcdefghijklmnopqrstuvwxyz0123456789\";\n  let result = \"\";\n  result = crypto.randomBytes(3).toString(\"hex\");\n  return result;\n}\n\n/**","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/shared/utils/apiKey.ts#L1-L29","documentation":"Fail-fast error from getApiKeySecret(): API_KEY_SECRET is unset or blank when an API-key CRC (checksum) operation is attempted. Since FASE-01 there is no hardcoded fallback; the startup secrets validator (instrumentation-node.ts) is expected to have provisioned it, so hitting this means startup validation was skipped or the env was emptied at runtime.","triggerScenarios":"Thrown at src/shared/utils/apiKey.ts:11 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Generate and set API_KEY_SECRET (e.g. `openssl rand -hex 32`) and restart the server","Verify .env is loaded and not overwritten by the deployment environment","Ensure the startup secrets validator ran (check for its boot logs, including the [SECURITY] warning)","Fix API-key operations being invoked before initialization order completes"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}