forked from 0xWheatyz/SPARC
Add startup check to reject default JWT secret in non-development environments #1618
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 item: P1 Security hardening
auth.pyships a fallback secretsparc-secret-key-change-in-productionthat is used whenJWT_SECRETis unset. If this default reaches a production environment, tokens are trivially forgeable.What to do
auth.py, detect whether the active JWT secret equals the known default value.on_event("startup")handler) that logs a fatal error and callssys.exit(1)when the default secret is present andAPP_ENV != "development"..env.exampleto includeJWT_SECRET=with a comment explaining the requirement.docker-compose.ymlto passAPP_ENV=developmentfor local dev so the check does not block local usage.Acceptance criteria
APP_ENV=productionfails at startup with a clear error message.APP_ENV=developmentstarts normally even without a custom secret.This issue has been resolved by previously merged PRs. The feature is already implemented in the codebase on main.
Closing as already resolved.