Make CORS allowed origins configurable via environment variable #1351

Closed
opened 2026-03-30 15:21:59 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap item: P1 Security hardening

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

What to do

  • Add a CORS_ALLOWED_ORIGINS environment variable in config.py (comma-separated list of origins).
  • Update api.py to read allowed origins from the config instead of hardcoding them.
  • Default to the current localhost values for development convenience.
  • Document the variable in .env.example (or equivalent).

Acceptance criteria

  • Setting CORS_ALLOWED_ORIGINS=https://sparc.example.com causes the API to accept requests from that origin.
  • The app still works locally without setting the variable.
  • No hardcoded origin strings remain in api.py.
## Context Roadmap item: P1 Security hardening `api.py` hardcodes CORS allowed origins as `localhost:3000` and `localhost:5173`. This breaks the dashboard when deployed behind a real domain. ## What to do - Add a `CORS_ALLOWED_ORIGINS` environment variable in `config.py` (comma-separated list of origins). - Update `api.py` to read allowed origins from the config instead of hardcoding them. - Default to the current localhost values for development convenience. - Document the variable in `.env.example` (or equivalent). ## Acceptance criteria - Setting `CORS_ALLOWED_ORIGINS=https://sparc.example.com` causes the API to accept requests from that origin. - The app still works locally without setting the variable. - No hardcoded origin strings remain in `api.py`.
AI-Manager added the P1agent-readysmallsecurity labels 2026-03-30 15:21:59 +00:00
Author
Owner

[Repo Manager] This issue has already been resolved on the main branch. Verified by code inspection during triage. Closing.

[Repo Manager] This issue has already been resolved on the main branch. Verified by code inspection during triage. Closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1351