-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
CASSANDRA-18428: Adding equals/hashCode override for the ServerEncryptionOptions #2269
Conversation
@@ -139,4 +156,47 @@ public void testDifferentCustomSslContextFactoryParameters() { | |||
assertNotEquals(encryptionOptions1, encryptionOptions2); | |||
assertNotEquals(encryptionOptions1.hashCode(), encryptionOptions2.hashCode()); | |||
} | |||
|
|||
@Test | |||
public void testServerEncryptionOptions() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nl for the left curly bracket.
@Test | ||
public void testServerEncryptionOptions() { | ||
EncryptionOptions.ServerEncryptionOptions encryptionOptions1 = createServerEncryptionOptions(); | ||
EncryptionOptions.ServerEncryptionOptions encryptionOptions2 =createServerEncryptionOptions(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EncryptionOptions.ServerEncryptionOptions encryptionOptions2 =createServerEncryptionOptions(); | |
EncryptionOptions.ServerEncryptionOptions encryptionOptions2 = createServerEncryptionOptions(); |
} | ||
|
||
@Test | ||
public void testServerEncryptionOptionsMismatchForOutboundKeystore() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nl for the left curly bracket.
} | ||
|
||
@Test | ||
public void testServerEncryptionOptionsMismatchForInboundKeystore() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nl for the left curly bracket.
result += 31 * (outbound_keystore == null ? 0 : outbound_keystore.hashCode()); | ||
result += 31 * (outbound_keystore_password == null ? 0 : outbound_keystore_password.hashCode()); | ||
return result; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline between methods.
return true; | ||
if (o == null || getClass() != o.getClass()) | ||
return false; | ||
if (!super.equals(o)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove the brackets at all here :-)
@@ -627,8 +627,8 @@ public ServerEncryptionOptions(ParameterizedClass sslContextFactoryClass, String | |||
InternodeEncryption internode_encryption, boolean legacy_ssl_storage_port_enabled) | |||
{ | |||
super(sslContextFactoryClass, keystore, keystore_password, truststore, truststore_password, cipher_suites, | |||
protocol, accepted_protocols, algorithm, store_type, require_client_auth, require_endpoint_verification, | |||
null, optional); | |||
protocol, accepted_protocols, algorithm, store_type, require_client_auth, require_endpoint_verification, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would exclude this from the PR as the formatting has nothing to do with the patch itself. Just not to avoid drawing attention to it in simple patches.
+ " its broadcast address in the handshake and bypass authentication. To ensure that mutual TLS" | ||
+ " authentication is not bypassed, please set internode_encryption to 'all'. Continuing with" | ||
+ " insecure configuration."); | ||
+ " It is possible for an internode connection to pretend to be in the same rack/dc by spoofing" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as above - as the formatting is not related to the change itself it is worth excluding it from the PR to avoid drawing attention to these lines.
The code-style is here, just for reference: |
@@ -35,6 +35,23 @@ | |||
*/ | |||
public class EncryptionOptionsEqualityTest | |||
{ | |||
private EncryptionOptions.ServerEncryptionOptions createServerEncryptionOptions() | |||
{ | |||
EncryptionOptions.ServerEncryptionOptions encryptionOptions = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can inline encryptionOptions
for simplicity.
Thanks @Mmuzaf for the review. I'll take a look at those soon. |
Thanks for sending a pull request! Here are some tips if you're new here:
Commit messages should follow the following format:
The Cassandra Jira