forked from 0xWheatyz/SPARC
Security: refuse to start with default JWT secret in non-dev environments #354
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?
Problem
auth.pyships a fallbacksparc-secret-key-change-in-productionthat will be used ifJWT_SECRETis unset. This means a misconfigured production deployment silently uses a known, public secret, making all tokens trivially forgeable.Work
lifespanor a startup event handler), detect ifJWT_SECRETis set to the default value.development(i.e.,ENV!=development), raise a fatal error and exit with a non-zero status code.JWT_SECRET.docker-compose.yml(dev) to setENV=developmentso local dev is unaffected.Acceptance Criteria
JWT_SECRETandENV != developmentcauses immediate startup failure with a descriptive message.ENV=developmentand the default secret succeeds (for local dev convenience).Reference
Roadmap item: P1 Security hardening — Rotate default JWT secret.
[Triage] Already implemented in main. auth.py (lines 24-32) has a startup check that refuses to start with the default JWT secret when APP_ENV is not 'development'. Closing as resolved.