forked from 0xWheatyz/SPARC
Make CORS allowed origins configurable via environment variable #1619
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
Roadmap item: P1 Security hardening
api.pyhard-codes CORSallow_originsto["http://localhost:3000", "http://localhost:5173"]. This means the dashboard cannot be served from any other domain without a code change.What to do
api.py(or whereverCORSMiddlewareis configured), read allowed origins from aCORS_ORIGINSenvironment variable.CORS_ORIGINS=https://sparc.example.com,https://sparc-staging.example.com.localhostdefaults when the variable is unset, so local dev behaviour is unchanged.CORS_ORIGINS=to.env.examplewith an explanatory comment.config.pyto include the new config key.Acceptance criteria
CORS_ORIGINS=https://example.comcauses the API to only allow that origin.CORS_ORIGINSkeeps the current localhost defaults.This issue has been resolved by previously merged PRs. The feature is already implemented in the codebase on main.
Closing as already resolved.