forked from 0xWheatyz/SPARC
Add startup check to reject default JWT secret in production #637
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
Roadmap item: P1 Security Hardening
auth.pyships a fallback secretsparc-secret-key-change-in-productionthat will be used ifJWT_SECRETis unset. This is a security risk in production deployments.What to do
auth.py, on application startup, check whetherJWT_SECRETis set to the default valuedevelopment(checkAPP_ENVorENVIRONMENTenv var), raise a fatal error and refuse to startAPP_ENV(default:production) toconfig.pyand document it in.env.exampleAcceptance criteria
JWT_SECRETis the default value, logging a clear error messageAPP_ENV=developmentis documented in.env.exampleor equivalentClosing as already implemented.
SPARC/auth.pycontains_check_jwt_secret()which rejects the default JWT secret whenAPP_ENVis notdevelopment. The.env.exampledocuments this behavior.