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

ELY-2435; ELY-2434; ELY-2433; ELY-2432 #1775

Merged
merged 6 commits into from
Sep 16, 2022
Merged

Conversation

keyasarkar
Copy link

Refer issues below:
ELY-2435
ELY-2434
ELY-2433
ELY-2432

ksarkar added 4 commits September 16, 2022 13:10
…Digest#isEqual to avoid a potential timing attack
…isEqual to avoid a potential timing attack
…t#isEqual to avoid a potential timing attack
@Skyllarr Skyllarr added the +1 DV label Sep 16, 2022
@@ -56,6 +57,7 @@ public boolean equals(final Object obj) {
return false;
}
RawSaltedSimpleDigestPassword other = (RawSaltedSimpleDigestPassword) obj;
return getAlgorithm().equals(other.getAlgorithm()) && Arrays.equals(digest, other.digest) && Arrays.equals(salt, other.salt);
return getAlgorithm().equals(other.getAlgorithm()) && MessageDigest.isEqual(digest, other.digest)
&& MessageDigest.isEqual(salt, other.salt);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a very small comment, we can continue to use Arrays.equals for the salt comparison.

Copy link
Author

Choose a reason for hiding this comment

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

cool.. will update 👍

Copy link
Author

Choose a reason for hiding this comment

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

For reference: reason to not change this is since salt is not user input, it is not susceptible to timing attack

}

public boolean equals(final Object obj) {
if (! (obj instanceof RawScramDigestPassword)) {
return false;
}
RawScramDigestPassword other = (RawScramDigestPassword) obj;
return iterationCount == other.iterationCount && getAlgorithm().equals(other.getAlgorithm()) && Arrays.equals(digest, other.digest) && Arrays.equals(salt, other.salt);
return iterationCount == other.iterationCount && getAlgorithm().equals(other.getAlgorithm())
&& MessageDigest.isEqual(digest, other.digest) && MessageDigest.isEqual(salt, other.salt);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a very small comment, we can continue to use Arrays.equals for the salt comparison.

Copy link
Author

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@fjuma fjuma left a comment

Choose a reason for hiding this comment

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

Thanks @keyasarkar!

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