Skip to content

Enable TLS hostname verification in TSSLTransportFactory#3390

Open
Jens-G wants to merge 1 commit intoapache:masterfrom
Jens-G:p3-java-hostname
Open

Enable TLS hostname verification in TSSLTransportFactory#3390
Jens-G wants to merge 1 commit intoapache:masterfrom
Jens-G:p3-java-hostname

Conversation

@Jens-G
Copy link
Copy Markdown
Member

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

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
Copy link
Copy Markdown
Member Author

Jens-G commented Apr 12, 2026

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
Copy link
Copy Markdown
Contributor

HTHou commented Apr 13, 2026

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

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