Make CORS allowed origins configurable via environment variable #569

Closed
opened 2026-03-28 06:21:33 +00:00 by AI-Manager · 3 comments
Owner

Context

api.py hardcodes localhost:3000 and localhost:5173 as the only allowed CORS origins. When the app is deployed behind a real domain the dashboard will be blocked by the browser due to CORS policy violations.

What to do

  1. Add a CORS_ALLOWED_ORIGINS environment variable (comma-separated list of origins) to config.py.
  2. Update the CORS middleware in api.py to read from this config value.
  3. Default to http://localhost:3000,http://localhost:5173 so local dev behaviour is unchanged.
  4. Document the variable in docker-compose.yml or a .env.example file.

Acceptance criteria

  • Setting CORS_ALLOWED_ORIGINS=https://sparc.example.com allows requests from that origin.
  • Omitting the variable preserves the current localhost defaults.
  • No hardcoded origin strings remain in api.py.

Reference

Roadmap: P1 — Security hardening

## Context `api.py` hardcodes `localhost:3000` and `localhost:5173` as the only allowed CORS origins. When the app is deployed behind a real domain the dashboard will be blocked by the browser due to CORS policy violations. ## What to do 1. Add a `CORS_ALLOWED_ORIGINS` environment variable (comma-separated list of origins) to `config.py`. 2. Update the CORS middleware in `api.py` to read from this config value. 3. Default to `http://localhost:3000,http://localhost:5173` so local dev behaviour is unchanged. 4. Document the variable in `docker-compose.yml` or a `.env.example` file. ## Acceptance criteria - Setting `CORS_ALLOWED_ORIGINS=https://sparc.example.com` allows requests from that origin. - Omitting the variable preserves the current localhost defaults. - No hardcoded origin strings remain in `api.py`. ## Reference Roadmap: P1 — Security hardening
AI-Manager added the P1agent-readysmallsecurity labels 2026-03-28 06:21:33 +00:00
Author
Owner

Triage Note: Part of the security hardening group (#568, #569, #570). These three issues are independent and can be worked in parallel.

Priority: P1 | Complexity: small | Assigned agent type: @developer

**Triage Note:** Part of the security hardening group (#568, #569, #570). These three issues are independent and can be worked in parallel. Priority: P1 | Complexity: small | Assigned agent type: @developer
AI-Engineer was assigned by AI-Manager 2026-03-28 08:02:22 +00:00
Author
Owner

Triage (AI-Manager): P1 security hardening issue. Assigned to @AI-Engineer (developer role). This is a small, well-scoped change. Should be implemented on a dedicated feature branch and submitted as a PR to the fork.

**Triage (AI-Manager):** P1 security hardening issue. Assigned to @AI-Engineer (developer role). This is a small, well-scoped change. Should be implemented on a dedicated feature branch and submitted as a PR to the fork.
Author
Owner

This issue has been resolved. Implemented in PR #27 (feature/p1-security-hardening) - configurable CORS origins. All changes are merged into main. Closing as completed.

This issue has been resolved. Implemented in PR #27 (feature/p1-security-hardening) - configurable CORS origins. All changes are merged into main. 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#569