Repository navigation
verify the certificate against hostname in dns.asyncquery.quic - #1371
Merged
Merged
Conversation
rthalley
pushed a commit
that referenced
this pull request
Oct 22, 2026
(cherry picked from commit ef6638c)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dns.asyncquery.quic()merges the deprecatedserver_hostnamealias intohostnameand then builds the QUIC manager withserver_name=server_hostname, so a call made with the documentedhostname=form hands aioquic no name at all. aioquic only matches the certificate against a name or IP address whenserver_nameis set, so withhostname=any certificate chaining to the trusted CAs was accepted whatever name or address it carried, and an on-path attacker holding any CA-issued certificate could impersonate the DoQ server.dns.query.quic()passeshostnameand is not affected; the async function has had the parameter since 2.8.0.Repro against the nano nameserver, whose certificate is for
localhost:dns.query.quic(q, "127.0.0.1", port=port, verify=ca, hostname="wrong.example")fails the handshake, whileawait dns.asyncquery.quic(...)with the same arguments returns the answer. The newtest_hostname_*tests intests/test_doq.pycover sync, asyncio and trio, and the two async ones fail before the change.NO_INTERNET=1 pytestpasses, andblack,ruff,pyrightandtyreport nothing new.