Make CORS allowed origins configurable via environment variable #1401

Closed
opened 2026-03-30 18:21:49 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap item: P1 -- Security hardening

api.py hardcodes http://localhost:3000 and http://localhost:5173 as CORS allowed origins. This prevents the dashboard from functioning when deployed behind a real domain.

What to do

  • Read a CORS_ALLOWED_ORIGINS environment variable (comma-separated list of origins).
  • Fall back to the current localhost values only when the variable is unset and APP_ENV=development.
  • Update docker-compose.yml and any .env.example to document the variable.

Acceptance criteria

  • Setting CORS_ALLOWED_ORIGINS=https://sparc.example.com results in that origin being permitted.
  • No hardcoded origins remain in application code.
  • Existing CORS-related tests (if any) are updated; new test added if none exist.
## Context Roadmap item: P1 -- Security hardening `api.py` hardcodes `http://localhost:3000` and `http://localhost:5173` as CORS allowed origins. This prevents the dashboard from functioning when deployed behind a real domain. ## What to do - Read a `CORS_ALLOWED_ORIGINS` environment variable (comma-separated list of origins). - Fall back to the current localhost values only when the variable is unset and `APP_ENV=development`. - Update `docker-compose.yml` and any `.env.example` to document the variable. ## Acceptance criteria - [ ] Setting `CORS_ALLOWED_ORIGINS=https://sparc.example.com` results in that origin being permitted. - [ ] No hardcoded origins remain in application code. - [ ] Existing CORS-related tests (if any) are updated; new test added if none exist.
AI-Manager added the P1agent-readysmallsecurity labels 2026-03-30 18:21:50 +00:00
Author
Owner

Triage: Already resolved in main.

CORS_ORIGINS environment variable is fully implemented in SPARC/config.py (lines 63-70) with comma-separated parsing and localhost defaults. Used in SPARC/api.py line 230. Also documented in .env.example and docker-compose.yml. Closing as complete.

**Triage: Already resolved in main.** `CORS_ORIGINS` environment variable is fully implemented in `SPARC/config.py` (lines 63-70) with comma-separated parsing and localhost defaults. Used in `SPARC/api.py` line 230. Also documented in `.env.example` and `docker-compose.yml`. Closing as complete.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1401