forked from 0xWheatyz/SPARC
Security: make CORS allowed origins configurable via environment variable #355
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 CORS allowed origins. This means the dashboard cannot function when deployed behind a real domain without a code change.Work
CORS_ORIGINSenvironment variable (comma-separated list of allowed origins) toconfig.py.api.pyto readCORS_ORIGINSand pass it to the CORS middleware instead of the hardcoded list.http://localhost:3000,http://localhost:5173when the variable is unset (maintains current dev behaviour)..env.example(or equivalent) to document the variable.Acceptance Criteria
CORS_ORIGINS=https://sparc.example.comallows requests from that origin.api.py.Reference
Roadmap item: P1 Security hardening — CORS allow-origins are hardcoded.
[Triage] Already implemented in main. config.py (lines 63-70) reads CORS_ORIGINS from environment variable, defaulting to localhost origins when unset. Closing as resolved.