Copilot commented on code in PR #19074:
URL: https://github.com/apache/iotdb/pull/19074#discussion_r4439402150
##########
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/RestService.java:
##########
@@ -151,8 +151,11 @@ public void stop() {
}
}
- private void configureSSL(SslContextFactory.Server sslContextFactory, String
sslProtocol) {
+ void configureSSL(SslContextFactory.Server sslContextFactory, String
sslProtocol) {
String protocol = RpcSslUtils.normalizeProtocol(sslProtocol);
sslContextFactory.setProtocol(protocol);
+ if (RpcSslUtils.requiresProtocolRestriction(protocol)) {
+ sslContextFactory.setIncludeProtocols(protocol);
Review Comment:
Jetty's protocol inclusion patterns are case-sensitive, whereas SSLContext
algorithm names are case-insensitive. With a previously accepted configuration
such as `ssl_protocol=tlsv1.2`, the context is created successfully but this
filter does not match the provider's `TLSv1.2` protocol name, leaving HTTPS
with no enabled protocols. Make the inclusion pattern case-insensitive and
quote the configured name so it is matched literally.
##########
iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/RpcSslUtils.java:
##########
@@ -70,6 +88,28 @@ public static TSSLTransportFactory.TSSLTransportParameters
createTSSLTransportPa
return new
TSSLTransportFactory.TSSLTransportParameters(resolveProtocol(sslProtocol),
null);
}
+ public static TServerSocket createServerSocket(
+ int port,
+ int clientTimeout,
+ InetAddress address,
+ TSSLTransportFactory.TSSLTransportParameters params)
+ throws TTransportException {
+ String sslProtocol = protocol;
+ TServerSocket serverSocket =
+ TSSLTransportFactory.getServerSocket(port, clientTimeout, address,
params);
+ try {
+ if (requiresProtocolRestriction(sslProtocol)) {
+ // A version-specific SSLContext does not restrict the server's
enabled protocol versions.
+ ((SSLServerSocket) serverSocket.getServerSocket())
+ .setEnabledProtocols(new String[] {sslProtocol});
Review Comment:
A previously valid setting such as `ssl_protocol=tlsv1.2` or `TLSV1.3` now
prevents the Thrift service from starting. `SSLContext.getInstance` accepts
algorithm names case-insensitively, but normalization preserves case and
`setEnabledProtocols` rejects these noncanonical names. Resolve the configured
value case-insensitively against the socket's supported protocol names before
applying the restriction.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]