Fail closed on explicitly empty CORS_ORIGINS
fix(api): fail closed on explicitly empty CORS_ORIGINS
Fail closed on explicitly empty CORS_ORIGINSebba65-fix-fail-closed-on-explicitly-empty-cors-cve-2026-61736fixfail closed explicitly empty cors origins
Committed by claude
commit message
fix(api): fail closed on explicitly empty CORS_ORIGINS
get_cors_origins() fell back to ["*"] whenever the filtered origin list was
empty, so an explicit CORS_ORIGINS= (operator clearing cross-origin access) or
an origin-less value silently widened to allow every origin. The wildcard
default should only apply when the setting is unset.
Since the config layer maps an unset CORS_ORIGINS to "*" (handled by the early
return), an empty filtered list can only come from an explicitly empty/
origin-less value -- so return the empty list and let it fail closed (no
cross-origin browser access). Also drop the credentials header for the
empty-list case. Add regression tests for CORS_ORIGINS= and a comma-only value.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ZwddG56G4QwLcbEsYLxmdEditor assessment
This commit patches CVE-2026-61736. The subject, fail closed on explicitly empty CORS_ORIGINS, states the new behavior directly. The body distinguishes unset from explicitly empty: because the config layer maps an unset value to a wildcard, an empty filtered list can only come from an operator clearing cross-origin access, which previously widened to allow every origin. It explains the fail-closed return and the dropped credentials header, and adds tests for an empty value and a comma-only value. The reasoning is sound and tailored, but the reader still needs the earlier commits to grasp the overall advisory, and no scope beyond api appears.