forked from 0xWheatyz/SPARC
Make CORS allowed origins configurable via environment variable #1095
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?
Background
api.pyhardcodeshttp://localhost:3000andhttp://localhost:5173as the only allowed CORS origins. Any deployment behind a real domain (e.g.,https://sparc.example.com) will have all browser requests blocked by CORS.What to do
CORS_ORIGINSenvironment variable (comma-separated list of origins) inconfig.py.http://localhost:3000,http://localhost:5173when the variable is absent.CORSMiddlewareinapi.py..env.exampleto show the variable.Acceptance criteria
CORS_ORIGINS=https://sparc.example.comcauses the app to allow only that origin.CORS_ORIGINSpreserves the current localhost defaults.Roadmap reference: P1 - Security hardening
This issue has been verified as already implemented in the current codebase. The acceptance criteria are met based on code review. Closing as completed.