Support IP address validation in certificate SAN #2873
Merged
+171
−27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Merging community contribution from PR #2865 by @tangtheone (Pei-Tang Huang)
Objective:
Enable SSL/TLS certificate validation for connections using IP addresses directly, without requiring the
hostNameInCertificateworkaround. Currently, the JDBC driver only validates DNS hostnames in certificates' Subject Alternative Name (SAN) extension, causing connection failures when users connect via IP address even when the certificate contains that IP in its SAN.Solutions:
SQLServerCertificateUtils.validateServerNameInCertificate()to check for both:Key Changes:
SQLServerCertificateUtils.javato add IP address (type 7) checking alongside existing DNS name (type 2) validationSSLCertificateValidationTest.javaTesting:
Standards Compliance: RFC 5280 Section 4.2.1.6 (Subject Alternative Name)
Original contribution: #2865