forked from 0xWheatyz/SPARC
Security: refuse to start with default JWT secret in non-dev environments #875
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
auth.pyships a fallbacksparc-secret-key-change-in-productionthat will be used ifJWT_SECRETis unset. This is a critical security risk in production deployments.Roadmap reference: P1 Security hardening
What to do
JWT_SECRETenv var is unset or matches the known default value.ENVIRONMENTorAPP_ENVvariable).developmentortestand the default secret is in use, raise a fatal error and exit before the server accepts connections.auth.py(or a startup event inapi.py).Acceptance criteria
JWT_SECRETis unset or default in a non-dev environment.JWT_SECRETrequirement.This issue has been resolved. The changes are already merged into main.
JWT startup guard implemented in auth.py (check_jwt_secret) and called at app startup in api.py. Server refuses to start with default secret in non-dev environments.
Closing as completed.