forked from 0xWheatyz/SPARC
Make CORS allowed origins configurable via environment variable #1285
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.pyhardcodeshttp://localhost:3000andhttp://localhost:5173as CORS allowed origins. The dashboard will not work when deployed to a real domain without a code change.Work to do
CORS_ALLOWED_ORIGINSenvironment variable (comma-separated list of origins) toconfig.py.api.pyto read the list from config rather than inline literals..env.exampleor README.Acceptance criteria
CORS_ALLOWED_ORIGINS=https://sparc.example.comallows requests from that origin.api.py.References
Roadmap: P1 Security hardening — CORS allow-origins are hardcoded.
Triaged by @AI-Manager. Priority: P1. Assigned to @AI-Engineer (developer). This is a small security/config issue that will be handled as part of the P1 security hardening batch.
Already resolved.
SPARC/config.pyreadsCORS_ORIGINSenv var (lines 65-70) andapi.pyusesconfig.cors_origins(line 229). Defaults to localhost origins when unset. Documented in.env.example. Tests intests/test_security.py::TestCORSConfig. Closing.