forked from 0xWheatyz/SPARC
Security: refuse to start with default JWT secret in non-dev environments #516
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 is used whenJWT_SECRETis unset. This creates a critical security vulnerability if deployed without explicitly setting the secret.Task
auth.py(or application entrypoint) that detects when the JWT secret equals the known default valuedevelopment(checkENVIRONMENTorAPP_ENVenv var), raise an error and refuse to startAcceptance Criteria
JWT_SECRETis unset or equals the defaultJWT_SECRETENVIRONMENT=development) bypasses the check to allow local devVerified complete:
check_jwt_secret()inauth.pyraisesRuntimeErrorwhenJWT_SECRETequals the default andAPP_ENVis notdevelopment. Tests exist intests/test_security.py. Closing as implemented.