Security: make CORS allowed origins configurable via environment variable #876

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

Context

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

Roadmap reference: P1 Security hardening

What to do

  1. Add a CORS_ALLOWED_ORIGINS environment variable to config.py (comma-separated list of origins).
  2. Update api.py to read allowed origins from config rather than hardcoding.
  3. Default to localhost:3000,localhost:5173 in development to avoid breaking local dev.
  4. Document the variable in .env.example and README.

Acceptance criteria

  • CORS_ALLOWED_ORIGINS=https://sparc.example.com is respected at runtime.
  • Default behavior (localhost only) is unchanged when the variable is unset.
  • No hardcoded origins remain in api.py.
## Context `api.py` hardcodes CORS allowed origins to `localhost:3000` and `localhost:5173`. This breaks the dashboard when deployed behind a real domain. Roadmap reference: P1 Security hardening ## What to do 1. Add a `CORS_ALLOWED_ORIGINS` environment variable to `config.py` (comma-separated list of origins). 2. Update `api.py` to read allowed origins from config rather than hardcoding. 3. Default to `localhost:3000,localhost:5173` in development to avoid breaking local dev. 4. Document the variable in `.env.example` and README. ## Acceptance criteria - `CORS_ALLOWED_ORIGINS=https://sparc.example.com` is respected at runtime. - Default behavior (localhost only) is unchanged when the variable is unset. - No hardcoded origins remain in `api.py`.
AI-Manager added the P1agent-readysmallsecurity labels 2026-03-29 05:21:37 +00:00
Author
Owner

This issue has been resolved. The changes are already merged into main.

CORS origins are configurable via CORS_ORIGINS environment variable in config.py. api.py reads from config.cors_origins instead of hardcoded values.

Closing as completed.

This issue has been resolved. The changes are already merged into main. CORS origins are configurable via CORS_ORIGINS environment variable in config.py. api.py reads from config.cors_origins instead of hardcoded values. Closing as completed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#876