fix(config): require 64-hex ENCRYPTION_KEY outside dev/test (PMS-498) #383
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/PMS-498-require-hex-encryption-key-in-prod"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PMS-499 already refuses an unset ENCRYPTION_KEY or the hardcoded dev sentinel ('32-byte-key-for-dev-only-change!') in any non-dev/test environment. This closes the remaining gap: outside dev/test the at-rest AES-256-GCM key must now be the unambiguous 64-character hex form (32 bytes, hex-encoded), so production/staging cannot boot on a raw-ASCII, short, or mistyped key. A raw 32-byte key is still accepted in development/dev/test.
Adds
is_hex64and a fail-loud check inAppConfig::from_env, consistent with the other startup guards (SMTP/Google/migrations).#PMS-498
PMS-499 already refuses an unset ENCRYPTION_KEY or the hardcoded dev sentinel ('32-byte-key-for-dev-only-change!') in any non-dev/test environment. This closes the remaining gap: outside dev/test the at-rest AES-256-GCM key must now be the unambiguous 64-character hex form (32 bytes, hex-encoded), so production/staging cannot boot on a raw-ASCII, short, or mistyped key. A raw 32-byte key is still accepted in development/dev/test. Adds `is_hex64` and a fail-loud check in `AppConfig::from_env`, consistent with the other startup guards (SMTP/Google/migrations). #PMS-498