Bug #115923 JDBC connector to ignore expiration when validateServerCert false
Submitted: 23 Aug 2024 20:12 Modified: 25 Aug 2024 16:41
Reporter: Jason Martin Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / J Severity:S4 (Feature request)
Version:9.0.0 OS:Any
Assigned to: CPU Architecture:Any

[23 Aug 2024 20:12] Jason Martin
Description:
The JDBC connector defaults to sslMode 'PREFERRED' which corresponds to {"useSSL=true", "requireSSL=false", "verifyServerCertificate=false"} per https://dev.mysql.com/doc/connector-j/en/connector-j-connp-props-security.html.  

However verifyServerCertificate=false does not fully ignore the content of the server certificate -- instead first checking the expiration status, *then* skips the rest of the validity checks based on the value of verifyServerCertificate.

This can create unexpected behavior whereby the user expects the client to not care about the content of the server SSL certificate, but in fact one attribute is still tested.

How to repeat:
Using default configuration, connect to a MySQL database that has an expired SSL certificate.

Suggested fix:
Migrate the expiration check, such as at https://github.com/mysql/mysql-connector-j/blob/e0e8e3461e5257ba4aa19e6b3614a2685b298947/s..., into the block gated by the value of validateServerCert.
[25 Aug 2024 16:41] MySQL Verification Team
Hello Jason Martin,

Thank you for the feature request!

regards,
Umesh