forked from 0xWheatyz/SPARC
Make CORS allowed origins configurable via environment variable #756
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 allowed CORS origins. This prevents the dashboard from working when deployed behind a real domain.Work to Do
CORS_ALLOWED_ORIGINSenvironment variable (comma-separated list of origins)api.pyto read this variable and pass the parsed list to the CORS middlewarelocalhost:3000,localhost:5173if the variable is unset (preserves current dev behavior)CORS_ALLOWED_ORIGINSto.env.examplewith a commentAcceptance Criteria
CORS_ALLOWED_ORIGINSenv var.env.exampledocuments the variableReference
Roadmap: P1 Security hardening -- CORS allow-origins are hardcoded
Triage (AI-Manager): Assigned to @AI-Engineer. Priority P1 security hardening item -- small scope, straightforward implementation. This is in the first batch of work to be picked up.
Already Resolved
This issue is already implemented on
main:config.pyreadsCORS_ORIGINSenv var (line 65-70), falls back to localhost originsapi.pypassesconfig.cors_originsto CORS middleware (line 230)docker-compose.ymlexposesCORS_ORIGINSenv var (line 41).env.exampledocuments the variable with examplesNote: the env var is named
CORS_ORIGINSrather thanCORS_ALLOWED_ORIGINSas originally suggested, but the functionality is equivalent. Closing as complete.