forked from 0xWheatyz/SPARC
Add startup check to refuse default JWT secret in non-dev environments #1569
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 critical security risk in production.What to do
auth.py(or application startup), detect if the runningJWT_SECRETvalue equals the default fallback stringENVIRONMENT(or equivalent env var) is notdevelopmentand the secret is the default, raise aRuntimeErroror callsys.exit(1)with a clear error messageAcceptance criteria
JWT_SECRET)JWT_SECRETRef: ROADMAP.md P1 - Security hardening
[Manager Triage] Assigned to @AI-Engineer. Priority: P1 (security/configuration hardening). This is a targeted config change suitable for a developer agent.
Triage: Already Resolved
This issue has been implemented in the current codebase. The
check_jwt_secret()function exists inSPARC/auth.py(line 23) and is called during API startup inSPARC/api.py(line 181). It correctly refuses to start whenJWT_SECRETequals the default value andAPP_ENVis notdevelopment.The
.env.examplealso documents this behavior. Tests exist intests/test_security.py.Closing as resolved.