fix: remove SUPABASE_SECRET_KEY fallback from encryptionKey()
From the PR description
Summary
- Removes
process.env.SUPABASE_SECRET_KEYfrom the fallback chain inencryptionKey()inbackend/src/lib/userApiKeys.ts USER_API_KEYS_ENCRYPTION_SECRET(or its aliasAPI_KEYS_ENCRYPTION_SECRET) is now required; the function throws if neither is set- Previously, a missing dedicated encryption secret silently fell back to the JWT verification secret, violating secret isolation (PR #74 / issue #66)
Closes #98 Closes #114 Closes #117 Closes #118
Changes
backend/src/lib/userApiKeys.ts- removeSUPABASE_SECRET_KEYfrom encryptionKey() fallback chainbackend/src/lib/__tests__/encryptionKey.test.ts- tests that SUPABASE_SECRET_KEY fallback is gone and dedicated secret is required;vi.mockhoisted to module top-levelbackend/package.json/backend/package-lock.json- addvitestdev dependency and"test": "vitest run"scriptbackend/vitest.config.ts- include filter scoping tests tosrc/to exclude compileddist/artifacts
Test plan
- Unit tests added and passing (3/3)
- Backend build passes
Our analysis
Require a dedicated encryption secret for user API keys — read the full analysis →
Think the analysis missed something the PR description covers?
Capture this PR into my fork
Download a Markdown prompt that tells Claude how to port every
commit in this PR into your working tree. Run it via
claude -p < capture-pull-107.md from
inside the repo you want the changes in.