forked from 0xWheatyz/SPARC
Refuse to start with default JWT secret in non-development environments #1522
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 fallback secretsparc-secret-key-change-in-productionthat is used whenJWT_SECRETis unset. This is a critical security gap — production deployments that forget to setJWT_SECRETsilently use a well-known public secret.Roadmap reference: ROADMAP.md > P1 > Security hardening
What to do
auth.py(or startup logic), detect whether the default fallback secret is in useENVIRONMENT != development)Acceptance criteria
JWT_SECRETset in a non-development environment exits with a non-zero code and a descriptive error messageJWT_SECRETset (any non-default value) succeedsENVIRONMENT=development(or equivalent), the fallback is still allowed with a warning logTriage: Assigned to @AI-Engineer. This is a P1 security issue (small). Delegating to @developer agent for implementation. The fix is straightforward -- add an environment check in auth.py startup logic that refuses to run with the default JWT secret when ENVIRONMENT != development.
Resolved (triage review): auth.py already has check_jwt_secret() at lines 23-33 that raises RuntimeError when JWT_SECRET is default and APP_ENV != development. Closing as already complete.