You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DNS rebinding :* allowlist matches Host/Origin suffixes that are not ports #3463
I reported this and I am happy to keep the fix on fix/dns-rebinding-wildcard-port (PR 3465). The suffix cases are in tests/server/test_transport_security.py. I will not open a replacement PR.
Written with AI assistance. I reproduced the Host wild.example:9000.evil case on 08a3bc8 before sending the patch.
I ran the same Request / validate_request snippet from the issue body against current TransportSecurityMiddleware. Host wild.example:9000.evil with allowed_hosts=["wild.example:*"] still returns None. Origin http://wild.example:9000.evil with allowed_origins=["http://wild.example:*"] is accepted the same way.
This matters if someone turns DNS rebinding protection on and uses :* to mean "this host, any port". A client that can set Host or Origin can satisfy the allowlist with a longer value, which is not a port.
Intended behaviour: base:* should match only base: plus a numeric port. Empty port and a suffix like 9000.evil should fail.
Approach I would take: one helper, base:* matches only base:<digits>, used by both Host and Origin. No new settings. Existing numeric-port cases stay accepted.
I reported this and would like to keep the fix on the existing fix/dns-rebinding-wildcard-port branch rather than open another PR.
Written with AI assistance. I re-read the matcher on 9972c21 and re-ran the suffix cases locally after merging that commit into the branch.
Activity
Oskii commentedon Sep 6, 2026
I reported this and I am happy to keep the fix on
fix/dns-rebinding-wildcard-port(PR 3465). The suffix cases are intests/server/test_transport_security.py. I will not open a replacement PR.Written with AI assistance. I reproduced the Host
wild.example:9000.evilcase on08a3bc8before sending the patch.Oskii commentedon Sep 8, 2026
Confirmed still on
main@9972c21.I ran the same
Request/validate_requestsnippet from the issue body against currentTransportSecurityMiddleware. Hostwild.example:9000.evilwithallowed_hosts=["wild.example:*"]still returnsNone. Originhttp://wild.example:9000.evilwithallowed_origins=["http://wild.example:*"]is accepted the same way.This matters if someone turns DNS rebinding protection on and uses
:*to mean "this host, any port". A client that can set Host or Origin can satisfy the allowlist with a longer value, which is not a port.Intended behaviour:
base:*should match onlybase:plus a numeric port. Empty port and a suffix like9000.evilshould fail.Approach I would take: one helper,
base:*matches onlybase:<digits>, used by both Host and Origin. No new settings. Existing numeric-port cases stay accepted.I reported this and would like to keep the fix on the existing
fix/dns-rebinding-wildcard-portbranch rather than open another PR.Written with AI assistance. I re-read the matcher on
9972c21and re-ran the suffix cases locally after merging that commit into the branch.