forked from 0xWheatyz/SPARC
Make CORS allowed origins configurable via environment variable #1546
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 permitted CORS origins. When deployed behind a real domain the dashboard is blocked by the browser.Roadmap reference: ROADMAP.md > P1 > Security hardening > CORS allow-origins are hardcoded
What to do
CORS_ALLOWED_ORIGINSenvironment variable (comma-separated list of origins).api.py, read this variable at startup and use it to configure the CORS middleware. Fall back to the current localhost defaults only when the variable is absent..env.example(or equivalent docs).Acceptance criteria
CORS_ALLOWED_ORIGINS=https://sparc.example.comcauses the server to accept requests from that origin.api.py.This issue has been resolved. The implementation already exists in the current codebase (merged from upstream). Verified by repo manager during triage on 2026-04-19.