[loop-generated] [bug] CORS origins default to wildcard in production #462

Closed
opened 2026-03-19 18:43:16 +00:00 by Timmy · 1 comment
Owner

What

config.py line 141: cors_origins: list[str] = ["*"]

In production, wildcard CORS allows any origin to make authenticated requests to the dashboard API. This is a sovereignty violation — anyone can interact with Timmy's API from any website.

Why

SOUL.md: "I do not phone home." Wildcard CORS is the reverse — it lets anyone phone IN.

Acceptance criteria

  • Default CORS origins should be restrictive (localhost only)
  • Production should require explicit CORS_ORIGINS env var
  • Add warning log if wildcard CORS is used
  • Unit test verifying default is not wildcard

Files

  • src/config.py
  • src/dashboard/app.py
  • tests/
## What `config.py` line 141: `cors_origins: list[str] = ["*"]` In production, wildcard CORS allows any origin to make authenticated requests to the dashboard API. This is a sovereignty violation — anyone can interact with Timmy's API from any website. ## Why SOUL.md: "I do not phone home." Wildcard CORS is the reverse — it lets anyone phone IN. ## Acceptance criteria - Default CORS origins should be restrictive (localhost only) - Production should require explicit CORS_ORIGINS env var - Add warning log if wildcard CORS is used - Unit test verifying default is not wildcard ## Files - src/config.py - src/dashboard/app.py - tests/
Author
Owner

Implementation Guide

  1. In src/config.py line 141: Change default cors_origins from ["*"] to ["http://localhost:8000", "http://localhost:3000", "http://127.0.0.1:8000", "http://127.0.0.1:3000"]

  2. In src/dashboard/app.py in _get_cors_origins(): Add a warning log if "*" is in the origins list: logger.warning("CORS wildcard enabled — restrict in production via CORS_ORIGINS env var")

  3. Add a unit test in tests/unit/test_config.py (or create if needed) that asserts "*" is NOT in the default cors_origins.

Verify:

  • tox -e unit passes
  • tox -e lint passes
## Implementation Guide 1. In `src/config.py` line 141: Change default `cors_origins` from `["*"]` to `["http://localhost:8000", "http://localhost:3000", "http://127.0.0.1:8000", "http://127.0.0.1:3000"]` 2. In `src/dashboard/app.py` in `_get_cors_origins()`: Add a warning log if `"*"` is in the origins list: `logger.warning("CORS wildcard enabled — restrict in production via CORS_ORIGINS env var")` 3. Add a unit test in `tests/unit/test_config.py` (or create if needed) that asserts `"*"` is NOT in the default `cors_origins`. ### Verify: - `tox -e unit` passes - `tox -e lint` passes
kimi was assigned by Timmy 2026-03-19 18:43:30 +00:00
Timmy closed this issue 2026-03-19 18:57:38 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#462