forked from 0xWheatyz/SPARC
Security: Add startup check to reject default JWT secret in non-dev environments #467
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
Problem
auth.pyships a fallbacksparc-secret-key-change-in-productionthat will be used if theJWT_SECRETenvironment variable is unset. This means a deployed instance can silently use a well-known, insecure secret.Task
auth.py(or application startup), detect when the currentJWT_SECRETvalue matches the default string.APP_ENV != development), raise a fatal error / refuse to start..env.exampleand any deployment docs to document the requirement.Acceptance Criteria
JWT_SECRETis the default value.APP_ENV=development) still starts fine with the default secret (with a warning).This has already been implemented.
check_jwt_secret()exists inSPARC/auth.py(lines 23-33) and is called during app startup inSPARC/api.py. It raisesRuntimeErrorifJWT_SECRETequals the default value andAPP_ENVis notdevelopment. Closing as completed.