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

CASSANDRA-18428: Adding equals/hashCode override for the ServerEncryptionOptions #2269

Closed

Conversation

maulin-vasavada
Copy link

Thanks for sending a pull request! Here are some tips if you're new here:

  • Ensure you have added or run the appropriate tests for your PR.
  • Be sure to keep the PR description updated to reflect all changes.
  • Write your PR title to summarize what this PR proposes.
  • If possible, provide a concise example to reproduce the issue for a faster review.
  • Read our contributor guidelines
  • If you're making a documentation change, see our guide to documentation contribution

Commit messages should follow the following format:

<One sentence description, usually Jira title or CHANGES.txt summary>

<Optional lengthier description (context on patch)>

patch by <Authors>; reviewed by <Reviewers> for CASSANDRA-#####

Co-authored-by: Name1 <email1>
Co-authored-by: Name2 <email2>

The Cassandra Jira

@@ -139,4 +156,47 @@ public void testDifferentCustomSslContextFactoryParameters() {
assertNotEquals(encryptionOptions1, encryptionOptions2);
assertNotEquals(encryptionOptions1.hashCode(), encryptionOptions2.hashCode());
}

@Test
public void testServerEncryptionOptions() {
Copy link
Contributor

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
EncryptionOptions.ServerEncryptionOptions encryptionOptions2 =createServerEncryptionOptions();
EncryptionOptions.ServerEncryptionOptions encryptionOptions2 = createServerEncryptionOptions();

}

@Test
public void testServerEncryptionOptionsMismatchForOutboundKeystore() {
Copy link
Contributor

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() {
Copy link
Contributor

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;
}
Copy link
Contributor

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)) {
Copy link
Contributor

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,
Copy link
Contributor

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"
Copy link
Contributor

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.

@Mmuzaf
Copy link
Contributor

Mmuzaf commented Jul 20, 2023

The code-style is here, just for reference:
https://cassandra.apache.org/_/development/code_style.html

@@ -35,6 +35,23 @@
*/
public class EncryptionOptionsEqualityTest
{
private EncryptionOptions.ServerEncryptionOptions createServerEncryptionOptions()
{
EncryptionOptions.ServerEncryptionOptions encryptionOptions =
Copy link
Contributor

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.

@maulin-vasavada
Copy link
Author

Thanks @Mmuzaf for the review. I'll take a look at those soon.

@maulin-vasavada
Copy link
Author

@Mmuzaf I have opened a new PR#2507 hence will close this. Can you please review that new PR? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants