Skip to content

Commit

Permalink
[fix][broker] Use MessageDigest.isEqual when comparing digests (apach…
Browse files Browse the repository at this point in the history
…e#21061)

(cherry picked from commit c05954e)
  • Loading branch information
Crispy-fried-chicken authored and michaeljmarshall committed Aug 24, 2023
1 parent 2498e4b commit c4ff7b9
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public String verifyAndExtract(String signedStr) throws AuthenticationException
String originalSignature = signedStr.substring(index + SIGNATURE.length());
String rawValue = signedStr.substring(0, index);
String currentSignature = computeSignature(rawValue);
if (!originalSignature.equals(currentSignature)) {
if (!MessageDigest.isEqual(originalSignature.getBytes(), currentSignature.getBytes())){
throw new AuthenticationException("Invalid signature");
}
return rawValue;
Expand Down

0 comments on commit c4ff7b9

Please sign in to comment.