forked from 0xWheatyz/SPARC
Make CORS allowed origins configurable via environment variable #925
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.pyhardcodeslocalhost:3000andlocalhost:5173as the only permitted CORS origins. This means the dashboard cannot be served from any real domain without a code change.Roadmap Reference
P1 Security hardening -- CORS allow-origins are hardcoded (ROADMAP.md)
What to do
api.py, read aCORS_ALLOW_ORIGINSenvironment variable (comma-separated list).http://localhost:3000,http://localhost:5173when the variable is unset (development convenience).CORSMiddleware.CORS_ALLOW_ORIGINSin.env.exampleand any deployment docs.Acceptance criteria
CORS_ALLOW_ORIGINS=https://sparc.example.comin the environment allows requests from that origin.This issue has been resolved.
SPARC/config.pylines 64-70 readCORS_ORIGINSfrom the environment (comma-separated) and fall back to localhost dev origins when unset.docker-compose.ymlpassesCORS_ORIGINS: ${CORS_ORIGINS:-}. Closing as completed.