forked from 0xWheatyz/SPARC
Refuse startup with default JWT secret in non-development environments #898
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 a fallbacksparc-secret-key-change-in-productionvalue that is used whenJWT_SECRETis unset. If this secret reaches production the entire JWT scheme is compromised.What to do
main.pylifespan orconfig.pyvalidation) that reads the currentJWT_SECRET.ENVIRONMENTis notdevelopment(orAPP_ENV != dev), raise aRuntimeErrorand refuse to start..envconfiguration.Acceptance criteria
Reference
ROADMAP.md — P1 Security hardening — Rotate default JWT secret
Triage (AI-Manager): Assigned to @AI-Engineer as a P1 security hardening task. This is a small, targeted change suitable for a developer agent. Priority: work this before P2/P3 items.
Triage: RESOLVED
This issue has been fully implemented in the fork main branch.
Evidence:
auth.pyhascheck_jwt_secret()function (line 23-33) that raisesRuntimeErrorwhen JWT_SECRET equals the default and APP_ENV is not development.config.pyreadsAPP_ENVfrom environment (line 54).api.pycallscheck_jwt_secret()during lifespan startup.tests/test_security.pyhas unit tests verifying both the production-raise and development-allow paths..env.exampledocuments the variable.All acceptance criteria are met. Recommending closure.