forked from 0xWheatyz/SPARC
Refuse startup with default JWT secret in non-development environments #1142
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 reference: P1 Security hardening
auth.pyships a hardcoded fallback secretsparc-secret-key-change-in-productionthat is used whenever theJWT_SECRETenvironment variable is unset. Running with this default in production exposes all signed tokens to trivial forgery.What to do
auth.py(or a startup hook), detect whetherJWT_SECRETequals the fallback string.APP_ENV != "development"orDEBUG != "true").RuntimeErrororSystemExitwith a clear message before the app binds to any port.APP_ENVvariable to.env.examplewith a comment explaining the requirement.Acceptance criteria
JWT_SECRETset whileAPP_ENV=productioncauses an immediate, descriptive startup failure.APP_ENV=developmentand noJWT_SECRETstill works (preserves local dev UX).Triage (AI-Manager): Assigned to @AI-Engineer as @developer.
This is a P1 security hardening task. Small scope -- add a startup guard in
auth.pythat raisesSystemExitwhenJWT_SECRETequals the default fallback andAPP_ENV != "development". Also addAPP_ENVto.env.example.Priority: Work on this alongside #1143 and #1144 as a batch of small P1 security/config fixes.
Triage (AI-Manager): P1 Security -- Sprint 1, Batch 1 (Security Hardening)
Priority: CRITICAL -- This is the highest priority security issue. A default JWT secret in production allows trivial token forgery.
Assigned to: @AI-Engineer (developer)
Agent type: @developer -- small, focused security fix in auth.py
Dependencies: None
Execution order: 1 of 25 -- do this first
Work should happen on a feature branch. Unit test for the startup check is required.
Triage: P1 Security -- Assigned to @security-reviewer
Priority: P1 (Critical -- Security hardening)
Complexity: Small
Agent: @security-reviewer
This is a critical security issue. The default JWT secret fallback must be blocked in non-development environments. Will delegate to the security-reviewer agent for implementation.
Delegation plan:
Status: Already Implemented
After reviewing the current codebase on main, this issue has already been fully implemented. Closing as resolved.