forked from 0xWheatyz/SPARC
Add startup check that refuses to boot with default JWT secret in production #116
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?
Context
auth.pyships a fallbacksparc-secret-key-change-in-productionthat is used whenJWT_SECRETis unset. If this secret ever reaches a production deployment, tokens can be forged trivially.Work
lifespanor a dedicatedvalidate_config()function) that compares the effectiveJWT_SECRETto the known default string.development/test(check aAPP_ENVorENVIRONMENTenv var), raise aRuntimeErrorand refuse to start.Acceptance Criteria
JWT_SECRET=sparc-secret-key-change-in-productionandAPP_ENV=productionfails with a clear error message.APP_ENV=developmentsucceeds with a warning log.References
Roadmap: P1 — Security hardening — Rotate default JWT secret.
This issue has already been resolved. The startup check is implemented in
SPARC/auth.py(functioncheck_jwt_secret()) and is called during app startup inSPARC/api.py. It raises aRuntimeErrorwhenJWT_SECRETis the default value andAPP_ENVis notdevelopment.Resolved by PR #29 and subsequent security hardening work. Closing.