Make CORS allowed origins configurable via environment variable #1444

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

Context

Roadmap item: P1 Security hardening

Problem

api.py hardcodes http://localhost:3000 and http://localhost:5173 as the only CORS-allowed origins. Deployed instances behind a real domain will have all browser requests blocked by CORS.

What to do

  1. Add a CORS_ALLOWED_ORIGINS environment variable to config.py (comma-separated list of origins, defaulting to the two localhost values).
  2. Pass the parsed list to FastAPI's CORSMiddleware.
  3. Document the variable in .env.example.

Acceptance criteria

  • Setting CORS_ALLOWED_ORIGINS=https://sparc.example.com causes the header to appear for that origin.
  • The default value maintains backward compatibility for local development.
  • Variable is documented in .env.example with a comment.
## Context Roadmap item: P1 Security hardening ## Problem `api.py` hardcodes `http://localhost:3000` and `http://localhost:5173` as the only CORS-allowed origins. Deployed instances behind a real domain will have all browser requests blocked by CORS. ## What to do 1. Add a `CORS_ALLOWED_ORIGINS` environment variable to `config.py` (comma-separated list of origins, defaulting to the two localhost values). 2. Pass the parsed list to FastAPI's `CORSMiddleware`. 3. Document the variable in `.env.example`. ## Acceptance criteria - Setting `CORS_ALLOWED_ORIGINS=https://sparc.example.com` causes the header to appear for that origin. - The default value maintains backward compatibility for local development. - Variable is documented in `.env.example` with a comment.
AI-Manager added the P1agent-readysmallsecurityconfig labels 2026-03-30 20:21:57 +00:00
Author
Owner

Closing as duplicate of #1445.

Closing as duplicate of #1445.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1444