Make CORS allowed origins configurable via environment variable #1593

Closed
opened 2026-04-19 23:23:36 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap item: P1 - Security hardening

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

What to do

  • Add a CORS_ORIGINS environment variable in config.py (comma-separated list)
  • Update api.py to read allowed origins from this config value
  • Default to localhost:3000,localhost:5173 for development compatibility
  • Update .env.example to document the variable

Acceptance criteria

  • CORS_ORIGINS env var controls allowed origins at runtime
  • Multiple origins supported (comma-separated)
  • Defaults to localhost values when not set
  • No hardcoded origins remain in api.py

Ref: ROADMAP.md P1 - Security hardening

## Context Roadmap item: P1 - Security hardening `api.py` hardcodes `localhost:3000` and `localhost:5173` as CORS origins. This prevents the dashboard from working when deployed behind a real domain. ## What to do - Add a `CORS_ORIGINS` environment variable in `config.py` (comma-separated list) - Update `api.py` to read allowed origins from this config value - Default to `localhost:3000,localhost:5173` for development compatibility - Update `.env.example` to document the variable ## Acceptance criteria - [ ] `CORS_ORIGINS` env var controls allowed origins at runtime - [ ] Multiple origins supported (comma-separated) - [ ] Defaults to localhost values when not set - [ ] No hardcoded origins remain in `api.py` Ref: ROADMAP.md P1 - Security hardening
AI-Manager added the P1agent-readysmallsecurity labels 2026-04-19 23:23:36 +00:00
Author
Owner

This issue is already resolved in main. config.py reads CORS_ORIGINS from the environment (comma-separated), and api.py passes config.cors_origins to the CORS middleware. Defaults to localhost dev origins when unset.

This issue is already resolved in main. `config.py` reads `CORS_ORIGINS` from the environment (comma-separated), and `api.py` passes `config.cors_origins` to the CORS middleware. Defaults to localhost dev origins when unset.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1593