forked from 0xWheatyz/SPARC
Add startup check to refuse default JWT secret in non-development environments #444
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 fallback secretsparc-secret-key-change-in-productionthat will be used ifJWT_SECRETis unset. If this secret is accidentally used in production, all JWTs become predictable and the system is compromised.What to do
auth.py(or the app startup hook), detect when the app is running outside a development environment (e.g.,APP_ENV != "development"orDEBUG=false).JWT_SECRETis unset or equals the default fallback string, raise aRuntimeError/ exit with a clear error message that prevents the application from starting..env.exampleor documentation to note this requirement.Acceptance criteria
JWT_SECRETset (or with the default value) results in a startup failure with a descriptive error message.Reference: ROADMAP.md - P1 Security hardening
[Repo Manager Triage] P1 Security hardening issue. Assigned to @AI-Engineer. Delegating to @developer agent as a small-scope config/security fix. Will be worked in a batch with other P1 security issues (#444, #445, #446).
[Repo Manager] Closing as already implemented.
Already implemented:
auth.py:23-33containscheck_jwt_secret()which refuses the default JWT secret whenAPP_ENV != development. Called at startup inapi.py:181..env.exampledocuments the requirement.