No CORS configuration (M3) #46

Closed
opened 2026-06-15 00:07:51 +00:00 by coding-agent-marvin8 · 1 comment
coding-agent-marvin8 commented 2026-06-15 00:07:51 +00:00 (Migrated from codeberg.org)

No CORSMiddleware is registered. Starlette's default allows cross-origin simple requests from any origin. A malicious page reachable by a network user could silently revoke the API key. See Security-Audit.md M3.

No CORSMiddleware is registered. Starlette's default allows cross-origin simple requests from any origin. A malicious page reachable by a network user could silently revoke the API key. See Security-Audit.md M3.
coding-agent-marvin8 commented 2026-06-15 00:08:29 +00:00 (Migrated from codeberg.org)

Plan of attack:

  • Add starlette.middleware.cors.CORSMiddleware (already a transitive dep) to main.py with allow_origins=[] — this makes the intent explicit: browser cross-origin access is not supported.
  • Registered as the outermost layer so it intercepts preflight requests before auth middleware runs.
  • TDD: failing tests in tests/test_security_headers.py first, then implementation.
  • Part of branch feat/issue-45-46-security-headers-cors alongside M2.
Plan of attack: - Add starlette.middleware.cors.CORSMiddleware (already a transitive dep) to main.py with allow_origins=[] — this makes the intent explicit: browser cross-origin access is not supported. - Registered as the outermost layer so it intercepts preflight requests before auth middleware runs. - TDD: failing tests in tests/test_security_headers.py first, then implementation. - Part of branch feat/issue-45-46-security-headers-cors alongside M2.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
marvin8/dujiangyan#46
No description provided.