Create QuicSslEngine for client with parameter peer host to meet hostname checker requirements#16200
Create QuicSslEngine for client with parameter peer host to meet hostname checker requirements#16200zrlw wants to merge 2 commits intoapache:3.3from
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 3.3 #16200 +/- ##
============================================
- Coverage 60.79% 60.75% -0.04%
+ Complexity 11751 11749 -2
============================================
Files 1953 1953
Lines 89119 89120 +1
Branches 13444 13444
============================================
- Hits 54177 54149 -28
- Misses 29368 29396 +28
- Partials 5574 5575 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR updates Dubbo’s HTTP/3 (QUIC) TLS setup to satisfy Netty’s default hostname verification by ensuring the client-side QUIC SSLEngine is created with a peer host, and refreshes the test server certificate to include a SAN for 127.0.0.1.
Changes:
- Create the client QUIC
SSLEnginewith(peerHost, peerPort)viasslEngineProvider(...)to support hostname verification. - Stop explicitly disabling endpoint identification in the HTTP/3 client SSL context builder.
- Update the HTTP/3 test server certificate (
server.pem) to include SANIP:127.0.0.1.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| dubbo-rpc/dubbo-rpc-triple/src/test/resources/certs/server.pem | Updates test server certificate to meet hostname verification (SAN) requirements. |
| dubbo-remoting/dubbo-remoting-http3/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyHttp3ConnectionClient.java | Creates QUIC SSLEngine with peer host/port via sslEngineProvider. |
| dubbo-remoting/dubbo-remoting-http3/src/main/java/org/apache/dubbo/remoting/http3/Http3SslContexts.java | Removes explicit disabling of endpoint identification algorithm for client QUIC SSL context. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| URL url = getUrl(); | ||
| QuicSslContext quicSslContext = Http3SslContexts.buildClientSslContext(url); | ||
| io.netty.channel.ChannelHandler codec = Http3Helper.configCodec(Http3.newQuicClientCodecBuilder(), getUrl()) | ||
| .sslContext(Http3SslContexts.buildClientSslContext(getUrl())) | ||
| .sslEngineProvider(q -> quicSslContext.newEngine(q.alloc(), url.getHost(), url.getPort())) | ||
| .build(); |
There was a problem hiding this comment.
The hostname passed to the QUIC SSLEngine is taken from url.getHost()/getPort(), but the actual remote endpoint is getConnectAddress() (which applies NetUtils.filterLocalHost(...) in AbstractClient#getConnectAddress). These can diverge for values like 127.x, 0.0.0.0, or localhost, causing hostname verification to validate against a different name than the one actually connected to (false failures or, worse, validating the wrong peer). Consider using the host/port from getConnectAddress() (or applying the same filterLocalHost logic) when creating the engine.
What is the purpose of the change?
peerhostand the CertificateException will be thrown atsun.security.util.HostnameChecker#matchdue to nullexpectedName,so we should create QuicSslEngine for client with parameter peer host to support hostname checker.
server.pemforTripleHttp3ProtocolTestchanged by adding SAN (set ip address to 127.0.0.1) configuration to meet HostnameChecker match requirements.Checklist