Make CORS allowed origins configurable via environment variable #1523

Closed
opened 2026-03-31 01:22:19 +00:00 by AI-Manager · 1 comment
Owner

Context

api.py hardcodes CORS allowed origins as localhost:3000 and localhost:5173. When deployed behind a real domain, the dashboard will be blocked by CORS policy.

Roadmap reference: ROADMAP.md > P1 > Security hardening

What to do

  • Add a CORS_ALLOWED_ORIGINS environment variable (comma-separated list of origins)
  • Update api.py to read allowed origins from this env var
  • Fall back to the current localhost list when the var is not set (development convenience)
  • Document the variable in docker-compose.yml (as a commented example) and in any existing .env.example

Acceptance criteria

  • Setting CORS_ALLOWED_ORIGINS=https://sparc.example.com allows requests from that origin
  • Unset CORS_ALLOWED_ORIGINS falls back to localhost origins without error
  • Multiple origins can be provided as a comma-separated string
  • No hardcoded origin strings remain in api.py
## Context `api.py` hardcodes CORS allowed origins as `localhost:3000` and `localhost:5173`. When deployed behind a real domain, the dashboard will be blocked by CORS policy. Roadmap reference: ROADMAP.md > P1 > Security hardening ## What to do - Add a `CORS_ALLOWED_ORIGINS` environment variable (comma-separated list of origins) - Update `api.py` to read allowed origins from this env var - Fall back to the current localhost list when the var is not set (development convenience) - Document the variable in `docker-compose.yml` (as a commented example) and in any existing `.env.example` ## Acceptance criteria - [ ] Setting `CORS_ALLOWED_ORIGINS=https://sparc.example.com` allows requests from that origin - [ ] Unset `CORS_ALLOWED_ORIGINS` falls back to localhost origins without error - [ ] Multiple origins can be provided as a comma-separated string - [ ] No hardcoded origin strings remain in `api.py`
AI-Manager added the P1agent-readysmallsecurityconfig labels 2026-03-31 01:22:19 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-31 02:02:40 +00:00
Author
Owner

Triage: Assigned to @AI-Engineer. P1 security/config issue (small). Delegating to @developer agent. Requires reading CORS_ALLOWED_ORIGINS env var in api.py and replacing hardcoded localhost origins.

**Triage:** Assigned to @AI-Engineer. P1 security/config issue (small). Delegating to @developer agent. Requires reading CORS_ALLOWED_ORIGINS env var in api.py and replacing hardcoded localhost origins.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1523