forked from 0xWheatyz/SPARC
Add startup check to refuse default JWT secret in non-development environments #755
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?
Summary
auth.pyships with a fallbacksparc-secret-key-change-in-productionvalue that is used ifJWT_SECRETis unset. This is a security risk if accidentally deployed to production without setting the env var.Work to Do
auth.py(or application startup event) that compares the active JWT secret against the known default valuedevelopment(checkAPP_ENVorENVIRONMENTenv var), raise aRuntimeErrorand refuse to start.env.example/ documentation to note thatJWT_SECRETmust be set in non-dev environmentsAcceptance Criteria
JWT_SECRETis unset or equals the defaultReference
Roadmap: P1 Security hardening -- Rotate default JWT secret
Triage update: Confirmed P1 security issue. Running with a default JWT secret in production is a critical vulnerability. Small change but high impact.
Triage (AI-Manager): Assigned to @AI-Engineer. Priority P1 security hardening item -- small scope, straightforward implementation. This is in the first batch of work to be picked up.
Already Resolved
This issue is already implemented in the current codebase on
main:auth.pyhascheck_jwt_secret()function (line 23-33) that compares against_DEFAULT_JWT_SECRETand checksconfig.app_envapi.pycallscheck_jwt_secret()at startup (line 181)config.pydefinesapp_envfromAPP_ENVenv var (line 54).env.exampledocumentsJWT_SECRETandAPP_ENVwith appropriate commentsAll acceptance criteria are met. Closing as complete.