Skip to content

Enable TLS hostname verification in TSSLTransportFactory - #3390

Merged
Jens-G merged 1 commit into
apache:masterfrom
Jens-G:p3-java-hostname
Apr 13, 2026
Merged

Jens-G merged 1 commit into
apache:masterfrom
Jens-G:p3-java-hostname

Conversation

@Jens-G

@Jens-G Jens-G commented Apr 11, 2026

Copy link
Copy Markdown
Member

Client: java

Set EndpointIdentificationAlgorithm to HTTPS on SSLSocket parameters in createClient() so that the server certificate CN/SAN is validated against the target hostname during TLS handshake.

Client: java

Set EndpointIdentificationAlgorithm to HTTPS on SSLSocket parameters
in createClient() so that the server certificate CN/SAN is validated
against the target hostname during TLS handshake.

(03)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mergeable mergeable Bot added the java Pull requests that update Java code label Apr 11, 2026
Comment on lines +347 to +349
SSLParameters sslParams = socket.getSSLParameters();
sslParams.setEndpointIdentificationAlgorithm("HTTPS");
socket.setSSLParameters(sslParams);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is back compactible?

@Jens-G

Jens-G commented Apr 12, 2026

Copy link
Copy Markdown
Member Author

Yes — SSLParameters.setEndpointIdentificationAlgorithm("HTTPS") is available since Java 1.7. The only behavioral change is that connections where the server certificate doesn't match the target hostname will now be rejected. IOW, correct deployments are unaffected.

https://docs.oracle.com/javase/7/docs/api/javax/net/ssl/SSLParameters.html#setEndpointIdentificationAlgorithm(java.lang.String)

@HTHou

HTHou commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

If enabled the TLS hostname verification in Java sync client, how about adding it in aync client as well?

@Jens-G
Jens-G merged commit 0919c3d into apache:master Apr 13, 2026
84 checks passed
@Jens-G
Jens-G deleted the p3-java-hostname branch April 13, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

java Pull requests that update Java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants