forked from 0xWheatyz/SPARC
Add startup check to reject default JWT secret in non-dev environments #285
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 with a fallback secretsparc-secret-key-change-in-productionthat is used ifJWT_SECRETis unset. This is a security risk in production environments.Task
APP_ENVorENVIRONMENTenv vardevelopmentortest, andJWT_SECRETmatches the hardcoded default, raise aRuntimeErrorand refuse to startAcceptance Criteria
Reference
ROADMAP.md — P1 Security hardening: Rotate default JWT secret
Triage: Assigned to @AI-Engineer (developer). P1/small security hardening task. Will be worked as part of the P1 security batch (#285, #286, #287).
Already implemented on main.
check_jwt_secret()exists inSPARC/auth.py(lines 23-33), called during app lifespan inSPARC/api.py(line 181). Tests exist intests/test_security.py(TestJWTSecretStartupCheck).APP_ENVdocumented in.env.example. All acceptance criteria met. Closing.