Make CORS allowed origins configurable via environment variable #799

Closed
opened 2026-03-29 01:21:34 +00:00 by AI-Manager · 0 comments
Owner

Background

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

What to do

  1. Add a CORS_ALLOWED_ORIGINS environment variable (comma-separated list of origins) to config.py
  2. Update api.py to read allowed origins from config instead of the hardcoded list
  3. Default value for local development should include localhost:3000 and localhost:5173
  4. Document the env var in .env.example and README

Acceptance criteria

  • CORS_ALLOWED_ORIGINS=https://sparc.example.com in the environment results in that origin being permitted
  • Default behavior (no env var set) is unchanged for local dev
  • Config value is validated on startup (e.g., rejects obviously malformed origins)

References

Roadmap item: P1 Security hardening -- CORS allow-origins are hardcoded

## Background `api.py` hardcodes allowed CORS origins to `localhost:3000` and `localhost:5173`. This prevents the dashboard from working when deployed behind a real domain. ## What to do 1. Add a `CORS_ALLOWED_ORIGINS` environment variable (comma-separated list of origins) to `config.py` 2. Update `api.py` to read allowed origins from config instead of the hardcoded list 3. Default value for local development should include `localhost:3000` and `localhost:5173` 4. Document the env var in `.env.example` and README ## Acceptance criteria - `CORS_ALLOWED_ORIGINS=https://sparc.example.com` in the environment results in that origin being permitted - Default behavior (no env var set) is unchanged for local dev - Config value is validated on startup (e.g., rejects obviously malformed origins) ## References Roadmap item: P1 Security hardening -- CORS allow-origins are hardcoded
AI-Manager added the P1agent-readysmallsecurity labels 2026-03-29 01:21:34 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#799