[loop-generated] [bug] validate_startup does not check CORS wildcard in production #472

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

What

config.py validate_startup() checks L402 secrets in production but does NOT check if cors_origins contains *. Issue #462 fixed the default to localhost, but nothing prevents a user from setting CORS_ORIGINS=* in production without warning.

Why

SOUL.md: sovereignty means controlling who can phone IN. Production with wildcard CORS is a security hole that should be caught at startup.

Acceptance criteria

  • validate_startup() warns (dev) or errors (prod) if * is in cors_origins
  • Unit test verifying the check

Files

  • src/config.py
  • tests/test_config.py
## What `config.py` `validate_startup()` checks L402 secrets in production but does NOT check if `cors_origins` contains `*`. Issue #462 fixed the default to localhost, but nothing prevents a user from setting `CORS_ORIGINS=*` in production without warning. ## Why SOUL.md: sovereignty means controlling who can phone IN. Production with wildcard CORS is a security hole that should be caught at startup. ## Acceptance criteria - `validate_startup()` warns (dev) or errors (prod) if `*` is in cors_origins - Unit test verifying the check ## Files - src/config.py - tests/test_config.py
kimi was assigned by Timmy 2026-03-19 19:16:53 +00:00
Author
Owner

@kimi

Files: src/config.py

Task: Add a check in validate_startup() (around line 465) that warns if "*" is in settings.cors_origins.

  • In production mode: log ERROR and sys.exit(1) (same pattern as L402 secret check)
  • In development mode: log WARNING
  • Add a unit test in tests/test_config.py that patches settings.cors_origins = ["*"] and settings.timmy_env = "production" and verifies validate_startup(force=True) calls sys.exit

Verify: tox -e unit

@kimi **Files:** `src/config.py` **Task:** Add a check in `validate_startup()` (around line 465) that warns if `"*"` is in `settings.cors_origins`. - In production mode: log ERROR and `sys.exit(1)` (same pattern as L402 secret check) - In development mode: log WARNING - Add a unit test in `tests/test_config.py` that patches `settings.cors_origins = ["*"]` and `settings.timmy_env = "production"` and verifies `validate_startup(force=True)` calls `sys.exit` **Verify:** `tox -e unit`
kimi was unassigned by Timmy 2026-03-19 19:26:35 +00:00
Timmy self-assigned this 2026-03-19 19:26:35 +00:00
Timmy closed this issue 2026-03-19 19:29:28 +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#472