forked from 0xWheatyz/SPARC
Refuse startup with default JWT secret in non-development environments #427
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 fallback secretsparc-secret-key-change-in-productionthat will be used ifJWT_SECRETis unset. This is a critical security risk if deployed to production without setting the environment variable.What to do
auth.py, on application startup, check whether the active JWT secret equals the known default valuedevelopment(checkAPP_ENVorENVIRONMENTenv var), raise a fatal error and refuse to startdocker-compose.ymlto document the requiredJWT_SECRETvariable in comments or.env.exampleAcceptance Criteria
JWT_SECRETset in a non-dev environment raises a startup error and exits with a non-zero code.env.examplefile (or updated comments) documents the requiredJWT_SECRETvariableReference
Roadmap: P1 - Security hardening - Rotate default JWT secret
Triage: Priority Wave 1 (Security). Assigned to @AI-Engineer. Dispatching @developer agent for implementation.
Resolution: Already implemented.
auth.pylines 16-33:check_jwt_secret()checks ifJWT_SECRETequals the default andconfig.app_env != "development", raisingRuntimeErrorto refuse startup.api.pyline 181: called during FastAPI lifespan startup.config.pyline 54:app_envreadsAPP_ENVenv var, defaulting to"development"..env.exampledocumentsJWT_SECRETandAPP_ENV.All acceptance criteria are met. Closing.