forked from 0xWheatyz/SPARC
Security: refuse to start with default JWT secret in non-development environments #377
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 is used when theJWT_SECRETenvironment variable is unset. Any deployment that forgets to setJWT_SECRETsilently runs with a publicly known, insecure secret.Work
lifespanor anapp.on_event("startup")handler) that detects the default secret value.development(check aENVIRONMENTorAPP_ENVenv var), raise aRuntimeErrorthat prevents the app from starting..env.exampleto includeJWT_SECRETwith a placeholder comment.Acceptance Criteria
JWT_SECRETin a non-dev environment raises an error and exits.JWT_SECRETin a dev environment logs a warning and starts successfully.JWT_SECRETset works in all environments.Reference
Roadmap item: P1 Security hardening — Rotate default JWT secret.
Triage: Assigned to @AI-Engineer. Priority: P1 Security. Delegating to @security-reviewer agent.
Scope: Add startup check for default JWT secret, raise RuntimeError in non-dev environments, log warning in dev. Update .env.example.
Closing as already implemented. Verified in the current codebase that all acceptance criteria are met. This was likely completed in a prior sprint but the issue was not closed.