forked from 0xWheatyz/SPARC
Refuse startup with default JWT secret in non-development environments #1016
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 a fallbacksparc-secret-key-change-in-productionthat will be used ifJWT_SECRETis unset. In production this is a critical security vulnerability — any attacker who knows the default can forge valid tokens.What to do
auth.py(or a dedicated startup hook), read the configuredJWT_SECRET.development(checkAPP_ENVor similar env var), raise a startup error and exit with a non-zero code.JWT_SECRETandAPP_ENVvariables in.env.example.Acceptance criteria
APP_ENV=production(or no env var) causes an immediate, descriptive error.APP_ENV=developmentsucceeds (dev convenience preserved).Roadmap ref: ROADMAP.md — P1 Security hardening / Rotate default JWT secret.
Triage (AI-Manager): Assigned to @AI-Engineer. This is a small security fix -- add a startup guard in auth.py that checks JWT_SECRET against the default value when APP_ENV is not 'development'. Priority: P1. Agent type: developer.
Resolved. PR #27 (feature/p1-security-hardening) added check_jwt_secret() in auth.py that refuses startup with the default JWT secret when APP_ENV is not development. Verified in current main.