forked from 0xWheatyz/SPARC
Refuse startup with default JWT secret in non-development environments #131
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-productionvalue used whenJWT_SECRETis unset. Deploying to production with this default is a critical security risk.Work
lifespanorstartupevent) that readsJWT_SECRETfrom the environment.JWT_SECRETequals the known default andENVIRONMENTis notdevelopment, raise aRuntimeErrorand prevent the app from starting.JWT_SECRETandENVIRONMENTin.env.example.Acceptance Criteria
JWT_SECRETis the default value andENVIRONMENT != development.References
Roadmap: P1 — Security hardening — Rotate default JWT secret.
Closing: auth.py includes enforce_jwt_secret() which raises RuntimeError if the default JWT secret is used in non-development environments. Resolved.