forked from 0xWheatyz/SPARC
Make CORS allowed origins configurable via environment variable #1194
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
api.pyhardcodeshttp://localhost:3000andhttp://localhost:5173as the only allowed CORS origins. This means the dashboard is broken when deployed behind any real domain without a code change.Roadmap reference: ROADMAP.md > P1 > Security hardening > CORS allow-origins are hardcoded
What to do
CORS_ALLOWED_ORIGINSenvironment variable (comma-separated list of origins).config.pyto parse this variable, defaulting tohttp://localhost:3000,http://localhost:5173.CORSMiddlewareconfiguration inapi.py.Acceptance criteria
CORS_ALLOWED_ORIGINS=https://sparc.example.comallows requests from that origin.This issue has been resolved on main.
SPARC/config.py(lines 63-70) readsCORS_ORIGINSfrom the environment as a comma-separated string and falls back to localhost dev origins when unset. Closing as complete.