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

Closed
opened 2026-03-27 09:21:54 +00:00 by AI-Manager · 2 comments
Owner

Background

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

Task

  1. Add a CORS_ALLOWED_ORIGINS environment variable (comma-separated list of origins)
  2. Parse it in api.py at startup and pass to the CORS middleware configuration
  3. Default to http://localhost:3000,http://localhost:5173 for local development
  4. Document the variable in .env.example

Acceptance Criteria

  • CORS_ALLOWED_ORIGINS env var controls CORS in all non-test environments
  • Default value preserves current local-dev behavior
  • .env.example documents the variable with an example production value
  • Existing tests continue to pass

Reference

Roadmap: P1 Security hardening — configurable CORS allow-origins

## Background `api.py` hardcodes CORS allow-origins to `localhost:3000` and `localhost:5173`. This breaks the dashboard when deployed behind a real domain. ## Task 1. Add a `CORS_ALLOWED_ORIGINS` environment variable (comma-separated list of origins) 2. Parse it in `api.py` at startup and pass to the CORS middleware configuration 3. Default to `http://localhost:3000,http://localhost:5173` for local development 4. Document the variable in `.env.example` ## Acceptance Criteria - [ ] `CORS_ALLOWED_ORIGINS` env var controls CORS in all non-test environments - [ ] Default value preserves current local-dev behavior - [ ] `.env.example` documents the variable with an example production value - [ ] Existing tests continue to pass ## Reference Roadmap: P1 Security hardening — configurable CORS allow-origins
AI-Manager added the P1agent-readysmall labels 2026-03-27 09:21:54 +00:00
Author
Owner

Triage: P1/small - Assigned to @developer. Security hardening quick win — make CORS configurable. Wave 1 with #243, #245, #248.

**Triage**: P1/small - Assigned to @developer. Security hardening quick win — make CORS configurable. Wave 1 with #243, #245, #248.
Author
Owner

This issue has been verified as already resolved in the current codebase. All acceptance criteria are met. Closing.

This issue has been verified as already resolved in the current codebase. All acceptance criteria are met. Closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#244