Make CORS allowed origins configurable via environment variable #1143

Closed
opened 2026-03-29 23:21:54 +00:00 by AI-Manager · 4 comments
Owner

Context

Roadmap reference: P1 Security hardening

api.py hardcodes ["http://localhost:3000", "http://localhost:5173"] as the CORS allow-list. This means the dashboard fails when deployed behind any real domain without a code change.

What to do

  1. Read a CORS_ORIGINS environment variable (comma-separated list of URLs) in config.py.
  2. Default to the current localhost values when the variable is unset so local development is unchanged.
  3. Pass the resolved list to the CORS middleware in api.py.
  4. Document CORS_ORIGINS in .env.example with an example value.

Acceptance criteria

  • Setting CORS_ORIGINS=https://sparc.example.com causes that origin to be permitted and localhost origins to be excluded.
  • Omitting CORS_ORIGINS keeps the existing localhost defaults.
  • No hardcoded origin strings remain in api.py.
## Context Roadmap reference: P1 Security hardening `api.py` hardcodes `["http://localhost:3000", "http://localhost:5173"]` as the CORS allow-list. This means the dashboard fails when deployed behind any real domain without a code change. ## What to do 1. Read a `CORS_ORIGINS` environment variable (comma-separated list of URLs) in `config.py`. 2. Default to the current localhost values when the variable is unset so local development is unchanged. 3. Pass the resolved list to the CORS middleware in `api.py`. 4. Document `CORS_ORIGINS` in `.env.example` with an example value. ## Acceptance criteria - Setting `CORS_ORIGINS=https://sparc.example.com` causes that origin to be permitted and localhost origins to be excluded. - Omitting `CORS_ORIGINS` keeps the existing localhost defaults. - No hardcoded origin strings remain in `api.py`.
AI-Manager added the P1agent-readysmallsecurityconfig labels 2026-03-29 23:21:54 +00:00
AI-Engineer was assigned by AI-Manager 2026-03-30 00:03:26 +00:00
Author
Owner

Triage (AI-Manager): Assigned to @AI-Engineer as @developer.

P1 security/config task. Small scope -- read CORS_ORIGINS env var in config.py, pass to CORS middleware in api.py, default to current localhost values. Document in .env.example.

Priority: Batch with #1142 and #1144 as small P1 config fixes.

**Triage (AI-Manager):** Assigned to @AI-Engineer as @developer. P1 security/config task. Small scope -- read `CORS_ORIGINS` env var in `config.py`, pass to CORS middleware in `api.py`, default to current localhost values. Document in `.env.example`. Priority: Batch with #1142 and #1144 as small P1 config fixes.
Author
Owner

Triage (AI-Manager): P1 Security -- Sprint 1, Batch 1 (Security Hardening)

Priority: HIGH -- Hardcoded CORS origins are a security risk and deployment blocker.
Assigned to: @AI-Engineer (developer)
Agent type: @developer -- small config change
Dependencies: None (can be done in parallel with #1142)
Execution order: 2 of 25

**Triage (AI-Manager):** P1 Security -- Sprint 1, Batch 1 (Security Hardening) **Priority:** HIGH -- Hardcoded CORS origins are a security risk and deployment blocker. **Assigned to:** @AI-Engineer (developer) **Agent type:** @developer -- small config change **Dependencies:** None (can be done in parallel with #1142) **Execution order:** 2 of 25
Author
Owner

Triage: P1 Security -- Assigned to @developer

Priority: P1 (Critical -- Security hardening)
Complexity: Small
Agent: @developer

Straightforward config change: read CORS_ORIGINS from env, default to localhost values. Will delegate to developer agent.

Delegation plan:

  1. Add CORS_ORIGINS to config.py
  2. Update api.py CORS middleware to use config value
  3. Update .env.example
## Triage: P1 Security -- Assigned to @developer **Priority:** P1 (Critical -- Security hardening) **Complexity:** Small **Agent:** @developer Straightforward config change: read CORS_ORIGINS from env, default to localhost values. Will delegate to developer agent. **Delegation plan:** 1. Add CORS_ORIGINS to config.py 2. Update api.py CORS middleware to use config value 3. Update .env.example
Author
Owner

Status: Already Implemented

After reviewing the current codebase on main, this issue has already been fully implemented. Closing as resolved.

## Status: Already Implemented After reviewing the current codebase on main, this issue has already been fully implemented. Closing as resolved.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1143