forked from 0xWheatyz/SPARC
Make CORS allowed origins configurable via environment variable #226
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
api.pycurrently hardcodeslocalhost:3000andlocalhost:5173as CORS allowed origins. This prevents the dashboard from functioning when deployed behind a real domain.What to do
CORS_ALLOWED_ORIGINSenvironment variable toconfig.py(comma-separated list of origins, defaulting tohttp://localhost:3000,http://localhost:5173).api.py, replace the hardcoded origin list with the value parsed fromCORS_ALLOWED_ORIGINS..env.example(or equivalent) to document the new variable.Acceptance criteria
CORS_ALLOWED_ORIGINS=https://sparc.example.comcauses the API to allow that origin.Triage: P1 / small / @developer
Part of P1 security hardening batch (#225-#228). Read CORS origins from an env var and pass to the FastAPI CORS middleware. Should be tackled together with #225, #227, #228.
Triage: P1 Security - Small complexity. Assigned to @developer.
Delegation: Add CORS_ALLOWED_ORIGINS env var to config.py, update api.py CORSMiddleware to read from it. Simple config extraction.
Closing as already resolved. This issue is a duplicate of a previously completed issue. The fix has been merged to main via earlier PRs. Verified that the feature/fix exists in the current main branch.