forked from 0xWheatyz/SPARC
Add startup check to refuse default JWT secret in non-dev environments #1545
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 fallbacksparc-secret-key-change-in-productionvalue that is used whenJWT_SECRETis unset. If this reaches production, all tokens are trivially forgeable.Roadmap reference: ROADMAP.md > P1 > Security hardening > Rotate default JWT secret
What to do
auth.py(or the application startup sequence), detect when the active JWT secret equals the known default string.development(checkAPP_ENVorENVIRONMENTenv var), raise aRuntimeErroror callsys.exit(1)with a clear message.Acceptance criteria
JWT_SECRETunset andAPP_ENV=productionresults in immediate exit with a descriptive error.JWT_SECRETunset andAPP_ENV=development(or unset) succeeds.JWT_SECRETvalue always succeeds.This issue has been resolved. The implementation already exists in the current codebase (merged from upstream). Verified by repo manager during triage on 2026-04-19.