Reject placeholder SECRET_KEY in all environments (it currently passes production validation) #45
Labels
No labels
area:ai
area:ci-cd
area:notifications
area:observability
area:public-pages
backlog
bug
duplicate
enhancement
help wanted
invalid
question
type:decision
type:feature
type:infra
type:maintenance
type:security
v1.0.1
v1.1.0
v1.2.0
v1.3.0
v2.0.0
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rbrooks/WeatherBot#45
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
.env.exampleshipsSECRET_KEY=changeme_generate_with_openssl_rand_hex_32.That value is 43 chars and not in
weak_secret_values(app/config.py:112-126), so it passes
validate_runtime()even underAPP_ENV=production. Session cookies (auth:session["user_id"]/role) aresigned with it, and
app/services/ai_secrets.py:11-14derives the Fernet keyfor stored AI provider keys from it. A deployment keeping the example value
runs with a publicly-known signing key.
Fix:
changemeprefix match to the rejected set,enforced in every environment (fail closed at startup).
.env.examplewith emptySECRET_KEY=and a generation comment; indevelopment, if unset, generate an ephemeral key and log a prominent warning.
so future SECRET_KEY rotation has a defined re-encryption path.
Acceptance criteria:
Filed from the 2026-07-17 codebase audit (
docs/.internal/report-2026-07-17.md), finding F-06.Fixed in #93 (merged to
main, deployed to dev). The exact placeholder and anychangeme*value are now rejected in every environment (fail-closed at startup);.env.exampleshipsSECRET_KEY=empty withopenssl rand -hex 32guidance; development generates an ephemeral key with a warning when unset. The Fernet-key derivation was deliberately left unchanged to avoid making already-encrypted AI provider keys undecryptable — decoupling it (with a re-encryption path) remains a possible future follow-up. Config tests cover placeholder/changemerejection in both prod and dev.