Encrypt member chat keys at rest (AES-256-GCM)

Member feedback: keys stored in plaintext in the portal DB are a
key-compromise incident waiting to happen. Members.key_token (the chat
key) is now encrypted with AES-256-GCM using a KEK from the PORTAL_KEK
env var. Plaintext exists only in memory when a key is served (dashboard,
LibreChat key feed, LiteLLM management). Startup migration encrypts
existing rows idempotently; fail-closed when the KEK is absent.
Member-managed API keys were already reveal-once (hash-only at rest).
This commit is contained in:
inference-bot committed 2026-10-28 16:48:58 -06:00
1 parent ac3d79a1df
commit 3ee385de12
3 files changed
+113 -9

No files matched your search

+1
View File
@@ -5,3 +5,4 @@ pydantic==2.9.2
PyJWT==2.9.0
slowapi==0.1.9
psycopg2-binary==2.9.9
cryptography==44.0.2