Skip to content

security(http): reject ambiguous duplicate Host headers - #41

Merged
harshitethic merged 2 commits into
mainfrom
security/reject-ambiguous-host-headers-20261025
Oct 27, 2026
Merged

harshitethic merged 2 commits into
mainfrom
security/reject-ambiguous-host-headers-20261025

Conversation

@harshitethic

Copy link
Copy Markdown
Owner

Problem

ApiAccessMiddleware validated headers.get('host'), which can select one of multiple Host headers. Downstream proxy/server hops may select another, creating an inconsistent authority boundary for this powerful local code-editing API.

Fix

Require exactly one Host header before origin and authentication checks in normal requests, independent of local/token mode. CORS preflight still cannot run handlers.

Tests

Real ASGI tests submit duplicate Host headers with and without a valid bearer token and assert rejection. Full CI pending.

@harshitethic
harshitethic marked this pull request as ready for review October 27, 2026 21:05
@harshitethic
harshitethic merged commit feaf652 into main Oct 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant