forked from 0xWheatyz/SPARC
Security: refuse to start with default JWT secret in non-development environments #1335
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?
Background
auth.pyships a fallback secretsparc-secret-key-change-in-productionthat is used if theJWT_SECRETenvironment variable is unset. This means a misconfigured production deployment silently uses a well-known, publicly-visible secret, making all issued tokens forgeable.What to do
auth.py(or the application entrypoint) that detects whenJWT_SECRETequals the default fallback value.development(check anAPP_ENVorENVIRONMENTvariable), raise an error and refuse to start."JWT_SECRET is set to the default insecure value. Set a strong secret before running in production.".env.exampleand any README/docs to document theJWT_SECRETrequirement.Acceptance criteria
APP_ENV=productioncauses a startup failure with a clear error message.APP_ENV=developmentstarts normally (dev convenience preserved).References
Roadmap: P1 — Security hardening — Rotate default JWT secret.
Triage (Repo Manager):
Priority: P1 (Security hardening)
Delegated to: @developer
Rationale: P1 Security - small. Startup check for default JWT secret. Straightforward guard clause in auth.py startup path.
This issue is part of the P1 security hardening batch. All P1 security issues should be addressed before P2/P3 work.
Triaged by repo manager: Already resolved. auth.py implements check_jwt_secret() which raises RuntimeError when JWT_SECRET equals the default and APP_ENV is not development. Called at startup via api.py lifespan. Closing.