forked from 0xWheatyz/SPARC
Add startup check to refuse default JWT secret in non-dev environments #1592
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 fallbacksparc-secret-key-change-in-productionthat will be used ifJWT_SECRETis unset. This is a security risk if deployed to production without setting the env var.What to do
JWT_SECRETequals the default valueENVIRONMENT != development, raise aRuntimeErroror exit with a clear error message.env.exampleto document this requirementAcceptance criteria
.env.exampledocuments the JWT_SECRET requirementRef: ROADMAP.md P1 - Security hardening
This issue is already resolved in main.
auth.pyimplementscheck_jwt_secret()which raisesRuntimeErrorwhenJWT_SECRETequals the default value andAPP_ENVis notdevelopment. The check is called at startup via thelifespanhandler inapi.py.