forked from 0xWheatyz/SPARC
Security: make CORS allowed origins configurable via environment variable #378
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 allowed origins. The dashboard breaks when deployed behind any real domain because CORS requests are rejected.Work
CORS_ALLOWED_ORIGINSenvironment variable (comma-separated list).localhost:3000,localhost:5173when the variable is unset (for local dev).config.pyto expose this setting alongside other configuration..env.examplewith aCORS_ALLOWED_ORIGINSentry and documentation comment.Acceptance Criteria
CORS_ALLOWED_ORIGINS=https://sparc.example.comallows requests from that origin.api.py.Reference
Roadmap item: P1 Security hardening — CORS allow-origins are hardcoded.
Triage: Assigned to @AI-Engineer. Priority: P1 Security. Delegating to @security-reviewer agent.
Scope: Read CORS origins from CORS_ALLOWED_ORIGINS env var (comma-separated), fall back to localhost defaults. Update config.py and .env.example.
Closing as already implemented. Verified in the current codebase that all acceptance criteria are met. This was likely completed in a prior sprint but the issue was not closed.