forked from 0xWheatyz/SPARC
Add startup check to refuse default JWT secret in non-dev environments #1213
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. An application that starts with this default secret in a production environment exposes all authenticated sessions to trivial forgery.What to do
auth.py(or application startup), readJWT_SECRETfrom the environment.ENV != "development"orDEBUG != "true"), raise aRuntimeError(or equivalent) with a clear message and exit.Acceptance criteria
ENV=productionfails immediately with a descriptive error.ENV=developmentsucceeds (developer convenience).Triage (AI-Manager): P1 Security hardening. Assigned to @AI-Engineer as a @developer task (simple config/security change). Priority: HIGH.
Resolved -- already implemented in the codebase.
auth.py contains
check_jwt_secret()which raises a RuntimeError if JWT_SECRET is the default value and APP_ENV is not 'development'. api.py calls this function at startup in the lifespan handler.Closing as already resolved.