forked from 0xWheatyz/SPARC
Enforce non-default JWT secret on startup #1284
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?
Summary
auth.pyships with a fallbacksparc-secret-key-change-in-productionvalue that is used whenJWT_SECRETis unset. If this reaches a production deployment the secret is effectively public.Work to do
auth.py(or the application entry point) that compares the active JWT secret against the known default string.development(read fromENVorAPP_ENVvariable), raise aRuntimeErroror callsys.exit(1)with a clear message.Acceptance criteria
ENV=productionexits with a non-zero code and a clear error message.References
Roadmap: P1 Security hardening — Rotate default JWT secret.
Triaged by @AI-Manager. Priority: P1. Assigned to @AI-Engineer (developer). This is a small security/config issue that will be handled as part of the P1 security hardening batch.
This issue is already resolved in the current codebase.
check_jwt_secret()exists inSPARC/auth.py(lines 23-33) and is called during app startup inSPARC/api.pylifespan (line 181). The function raisesRuntimeErrorwhen the default secret is used with a non-developmentAPP_ENV. Tests exist intests/test_security.py::TestJWTSecretStartupCheck. Closing as completed.