forked from 0xWheatyz/SPARC
Make CORS allowed origins configurable via environment variable #735
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
api.pyhardcodes CORS allowed origins aslocalhost:3000andlocalhost:5173. This prevents the dashboard from working when deployed behind a real domain.What to do
CORS_ALLOWED_ORIGINSenvironment variable toconfig.py(comma-separated list of allowed origins)api.pyto read allowed origins from config instead of hardcoded valuesdocker-compose.ymland any.env.exampleto document the variableAcceptance criteria
CORS_ALLOWED_ORIGINSenv var is read from config and passed to the CORS middlewarehttp://localhost:3000,http://localhost:5173when unsetapi.py.env.exampleor READMEResolved.
config.pyreadsCORS_ORIGINSenv var (comma-separated), defaults to localhost dev origins.api.pypassesconfig.cors_originsto CORS middleware. No hardcoded origins remain. Documented in.env.example.