forked from 0xWheatyz/SPARC
Add startup check to refuse default JWT secret in non-dev environments #401
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. This is a critical security risk in production.What to do
Add a startup check (e.g., in the FastAPI lifespan or app factory) that:
JWT_SECRETenvironment variabledevelopment(check viaAPP_ENVor similar), raise aRuntimeErrorand refuse to startAcceptance Criteria
pytestpasses with a new test that patchesJWT_SECRETto the default value and verifies startup fails outside dev modeAPP_ENV=developmentand the default secret still worksAPP_ENV=productioncauses the process to exit with a non-zero code and a clear error messageReference
Roadmap: P1 - Security hardening
Triage: Already Implemented
After reviewing the codebase, this issue has already been fully implemented in the current
mainbranch.This issue can be closed.