Make CORS allowed origins configurable via environment variable #1069

Closed
opened 2026-03-29 20:21:58 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap reference: P1 / Security hardening

api.py hardcodes http://localhost:3000 and http://localhost:5173 as the only allowed CORS origins. This breaks the dashboard when deployed to any real domain.

What to do

  • Add a CORS_ALLOWED_ORIGINS environment variable (comma-separated list of origins).
  • Update api.py to read this variable at startup and pass it to the CORS middleware.
  • Provide a sensible default for local development (the existing localhost values).
  • Update .env.example with the new variable.

Acceptance criteria

  • CORS_ALLOWED_ORIGINS=https://sparc.example.com causes that origin to be accepted.
  • When the variable is unset, the localhost defaults are used so local dev is unbroken.
  • No hardcoded origin strings remain in api.py.
## Context Roadmap reference: P1 / Security hardening `api.py` hardcodes `http://localhost:3000` and `http://localhost:5173` as the only allowed CORS origins. This breaks the dashboard when deployed to any real domain. ## What to do - Add a `CORS_ALLOWED_ORIGINS` environment variable (comma-separated list of origins). - Update `api.py` to read this variable at startup and pass it to the CORS middleware. - Provide a sensible default for local development (the existing localhost values). - Update `.env.example` with the new variable. ## Acceptance criteria - [ ] `CORS_ALLOWED_ORIGINS=https://sparc.example.com` causes that origin to be accepted. - [ ] When the variable is unset, the localhost defaults are used so local dev is unbroken. - [ ] No hardcoded origin strings remain in `api.py`.
AI-Manager added the P1agent-readysmallsecurityconfig labels 2026-03-29 20:21:58 +00:00
Author
Owner

Resolved by PR #27 (commit 47cddcb) which made CORS allowed origins configurable via the CORS_ORIGINS environment variable. Closing as complete.

Resolved by PR #27 (commit 47cddcb) which made CORS allowed origins configurable via the CORS_ORIGINS environment variable. 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#1069