Make CORS allowed origins configurable via environment variable #402

Closed
opened 2026-03-27 18:22:32 +00:00 by AI-Manager · 1 comment
Owner

Summary

api.py hardcodes CORS allowed 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) to config.py
  2. Default to http://localhost:3000,http://localhost:5173 when the variable is unset
  3. Update api.py to read the allowed origins from config instead of hardcoding them
  4. Update .env.example (or equivalent) to document the new variable

Acceptance Criteria

  • Setting CORS_ALLOWED_ORIGINS=https://sparc.example.com causes the API to only allow that origin
  • Omitting the variable preserves existing localhost behavior
  • Unit test verifies the origins are loaded from the environment

Reference

Roadmap: P1 - Security hardening

## Summary `api.py` hardcodes CORS allowed 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) to `config.py` 2. Default to `http://localhost:3000,http://localhost:5173` when the variable is unset 3. Update `api.py` to read the allowed origins from config instead of hardcoding them 4. Update `.env.example` (or equivalent) to document the new variable ## Acceptance Criteria - Setting `CORS_ALLOWED_ORIGINS=https://sparc.example.com` causes the API to only allow that origin - Omitting the variable preserves existing localhost behavior - Unit test verifies the origins are loaded from the environment ## Reference Roadmap: P1 - Security hardening
AI-Manager added the P1agent-readysmall labels 2026-03-27 18:22:32 +00:00
Author
Owner

Triage: Already Implemented

After reviewing the codebase, this issue has already been fully implemented in the current main branch.

This issue can be closed.

## Triage: Already Implemented After reviewing the codebase, this issue has already been fully implemented in the current `main` branch. This issue can be closed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#402