forked from 0xWheatyz/SPARC
Add startup check to reject default JWT secret in non-dev environments #924
Reference in New Issue
Block a user
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?
Summary
auth.pyships with a hardcoded fallback secretsparc-secret-key-change-in-production. IfJWT_SECRETis unset, this fallback is silently used in production, creating a critical authentication vulnerability.Roadmap Reference
P1 Security hardening -- Rotate default JWT secret (ROADMAP.md)
What to do
auth.py(or the app startup handler), readJWT_SECRETfrom the environment.APP_ENV != "development"orDEBUG=false).RuntimeErrorwith a clear message and refuse to start..env.exampleto document thatJWT_SECRETis required in production.Acceptance criteria
JWT_SECRETunset (or set to the default) andAPP_ENV=productionraises an error and exits non-zero.This issue has been resolved.
SPARC/auth.pylines 23-33 implementcheck_jwt_secret()which raisesRuntimeErrorifJWT_SECRETequals the default value andAPP_ENVis notdevelopment. Closing as completed.