forked from 0xWheatyz/SPARC
Make CORS allowed origins configurable via environment variable #336
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?
Problem
api.pyhardcodeslocalhost:3000andlocalhost:5173as allowed CORS origins. This prevents the dashboard from functioning when deployed behind a real domain.Work
CORS_ORIGINSenvironment variable (comma-separated list of allowed origins).config.pyto exposecors_origins: list[str].CORSMiddlewaresetup to use the configured list.Acceptance Criteria
CORS_ORIGINS=https://sparc.example.comallows requests from that origin.CORS_ORIGINSset, localhost defaults are used..env.example(create one if it does not exist).Reference
Roadmap item: Security hardening — CORS allow-origins are hardcoded.
[Repo Manager] This issue is resolved. config.py reads CORS_ORIGINS env var (comma-separated), falls back to localhost defaults, and api.py passes config.cors_origins to CORSMiddleware.