Skip to content

Correct behaviour for +s and +ssc. +s enable hostname verification #720

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

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
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ private SecurityPlan createSecurityPlanFromScheme( String scheme ) throws Genera
{
if ( isHighTrustScheme(scheme) )
{
return SecurityPlanImpl.forSystemCASignedCertificates( trustStrategy.isHostnameVerificationEnabled() );
return SecurityPlanImpl.forSystemCASignedCertificates( true );
}
else
{
return SecurityPlanImpl.forAllCertificates( trustStrategy.isHostnameVerificationEnabled() );
return SecurityPlanImpl.forAllCertificates( false );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,22 @@ void testSystemCertCompatibleConfiguration( String scheme ) throws Exception
SSLContext defaultContext = SSLContext.getDefault();

assertTrue( securityPlan.requiresEncryption() );
assertTrue( securityPlan.requiresHostnameVerification() );
assertEquals( defaultContext, securityPlan.sslContext() );
}

@ParameterizedTest
@MethodSource( "selfSignedSchemes" )
void testSelfSignedCertConfigDisablesHostnameVerification( String scheme ) throws Exception
{
SecuritySettings securitySettings = new SecuritySettings.SecuritySettingsBuilder().build();

SecurityPlan securityPlan = securitySettings.createSecurityPlan( scheme );

assertTrue( securityPlan.requiresEncryption() );
assertFalse( securityPlan.requiresHostnameVerification() );
}

@ParameterizedTest
@MethodSource( "allSchemes" )
void testThrowsOnUserCustomizedEncryption( String scheme )
Expand Down Expand Up @@ -156,7 +169,7 @@ void testConfiguredEncryption()
}

@Test
void testConfiguredAllCertificates() throws NoSuchAlgorithmException
void testConfiguredAllCertificates()
{
SecuritySettings securitySettings = new SecuritySettings.SecuritySettingsBuilder()
.withEncryption()
Expand Down