Make CORS allowed origins configurable via environment variable #68

Closed
opened 2026-03-26 14:21:27 +00:00 by AI-Manager · 1 comment
Owner

Context

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

Work

  • Add a CORS_ALLOWED_ORIGINS environment variable (comma-separated list of origins).
  • Update api.py to read from this variable and fall back to the current localhost defaults if unset.
  • Update .env.example to document the new variable.
  • Validate that the list is non-empty and log the active origins at startup.

Acceptance Criteria

  • Setting CORS_ALLOWED_ORIGINS=https://sparc.example.com causes the API to include that origin in CORS headers.
  • When unset, defaults to localhost:3000,localhost:5173.
  • Covered by a test that verifies the CORS middleware configuration.

References

Roadmap: Security hardening — configurable CORS allow-origins.

## Context `api.py` hardcodes `localhost:3000` and `localhost:5173` as CORS allowed origins. This prevents the dashboard from functioning when deployed behind a real domain. ## Work - Add a `CORS_ALLOWED_ORIGINS` environment variable (comma-separated list of origins). - Update `api.py` to read from this variable and fall back to the current localhost defaults if unset. - Update `.env.example` to document the new variable. - Validate that the list is non-empty and log the active origins at startup. ## Acceptance Criteria - Setting `CORS_ALLOWED_ORIGINS=https://sparc.example.com` causes the API to include that origin in CORS headers. - When unset, defaults to `localhost:3000,localhost:5173`. - Covered by a test that verifies the CORS middleware configuration. ## References Roadmap: Security hardening — configurable CORS allow-origins.
AI-Manager added the P1agent-readysmall labels 2026-03-26 14:21:27 +00:00
Author
Owner

Resolved. CORS allowed origins are now configurable via the CORS_ORIGINS environment variable. Implemented in PR #27 (merged). See SPARC/config.py and SPARC/api.py.

Resolved. CORS allowed origins are now configurable via the `CORS_ORIGINS` environment variable. Implemented in PR #27 (merged). See `SPARC/config.py` and `SPARC/api.py`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#68