fix(config): require 64-hex ENCRYPTION_KEY outside dev/test (PMS-498) #383

Merged
David merged 1 commit from fix/PMS-498-require-hex-encryption-key-in-prod into main 2026-06-26 14:07:56 +02:00
Member

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

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
fix(config): require 64-hex ENCRYPTION_KEY outside dev/test (PMS-498)
All checks were successful
E2E / Playwright against staging (pull_request) Successful in 44s
Check / fmt + clippy + build + tests (pull_request) Successful in 4m55s
Create release / Gate (release-branch merges only) (pull_request) Successful in 0s
Create release / Create release from merged PR (pull_request) Has been skipped
Integration / integration tests (pull_request) Successful in 26m51s
cb2789ef64
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
David merged commit ac07565217 into main 2026-06-26 14:07:56 +02:00
David deleted branch fix/PMS-498-require-hex-encryption-key-in-prod 2026-06-26 14:07:57 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-server!383
No description provided.