forked from 0xWheatyz/SPARC
Security: Make CORS allowed origins configurable via environment variable #710
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?
Summary
api.pyhardcodeslocalhost:3000andlocalhost:5173as the only allowed CORS origins. This breaks the dashboard when deployed behind a real domain.What to do
CORS_ALLOWED_ORIGINSenvironment variable (comma-separated list of origins).api.pyto read this variable at startup and pass it to the CORS middleware.localhost:3000,localhost:5173when the variable is unset (development default)..env.example.Acceptance Criteria
CORS_ALLOWED_ORIGINS=https://sparc.example.comallows requests from that origin.api.py..env.exampledocumentsCORS_ALLOWED_ORIGINS.Reference
Roadmap: P1 Security hardening — CORS allow-origins are hardcoded.
[Repo Manager] Already resolved. CORS_ORIGINS env var parsed in config.py (lines 65-70). Falls back to localhost dev origins. .env.example documents it.
Closing as already implemented in the codebase.