Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn off hostname verification for trustAllCertificates TrustStrategy #1301

Merged
merged 1 commit into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion driver/src/main/java/org/neo4j/driver/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -790,12 +790,14 @@ public static TrustStrategy trustSystemCertificates() {

/**
* Trust strategy for certificates that trust all certificates blindly. Suggested to only use this in tests.
* <p>
* This trust strategy comes with hostname verification turned off by default since driver version 5.0.
*
* @return an authentication config
* @since 1.1
*/
public static TrustStrategy trustAllCertificates() {
return new TrustStrategy(Strategy.TRUST_ALL_CERTIFICATES);
return new TrustStrategy(Strategy.TRUST_ALL_CERTIFICATES).withoutHostnameVerification();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,7 @@ public class StartTest implements TestkitRequest {
COMMON_SKIP_PATTERN_TO_REASON.put(
"^.*\\.test_partial_summary_contains_updates$", "Does not contain updates because value is zero");
COMMON_SKIP_PATTERN_TO_REASON.put("^.*\\.test_supports_multi_db$", "Database is None");
String skipMessage =
"This test expects hostname verification to be turned off when all certificates are trusted";
COMMON_SKIP_PATTERN_TO_REASON.put(
"^.*\\.TestTrustAllCertsConfig\\.test_trusted_ca_wrong_hostname$", skipMessage);
COMMON_SKIP_PATTERN_TO_REASON.put(
"^.*\\.TestTrustAllCertsConfig\\.test_untrusted_ca_wrong_hostname$", skipMessage);
skipMessage = "Driver handles connection acquisition timeout differently";
var skipMessage = "Driver handles connection acquisition timeout differently";
COMMON_SKIP_PATTERN_TO_REASON.put(
"^.*\\.TestConnectionAcquisitionTimeoutMs\\.test_should_encompass_the_handshake_time.*$", skipMessage);
COMMON_SKIP_PATTERN_TO_REASON.put(
Expand Down