coheigea commented on code in PR #3165:
URL: https://github.com/apache/cxf/pull/3165#discussion_r3339377023


##########
rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthUtils.java:
##########
@@ -88,6 +88,13 @@ public static void 
setCertificateThumbprintConfirmation(MessageContext mc, X509C
         }
     }
 
+    public static boolean compareTokens(String token1, String token2) {
+        if (token1 == null || token2 == null) {
+            return false;
+        }
+        return MessageDigest.isEqual(StringUtils.toBytesUTF8(token1), 
StringUtils.toBytesUTF8(token2));

Review Comment:
   @reta It's a standard way of ensuring constant time comparison to avoid 
leaking information about which character the comparison fails at. I think we 
didn't do it before here as we're comparing tokens that should have high 
entropy, but it doesn't hurt to use it I guess.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to