You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2022/01/13 05:34:39 UTC

[GitHub] [cassandra] bereng commented on a change in pull request #1398: PasswordObfuscator should not assume PASSWORD is the last item in the…

bereng commented on a change in pull request #1398:
URL: https://github.com/apache/cassandra/pull/1398#discussion_r783642456



##########
File path: src/java/org/apache/cassandra/cql3/QueryEvents.java
##########
@@ -250,10 +242,19 @@ public void notifyPrepareFailure(@Nullable CQLStatement statement, String query,
         }
     }
 
-    private String possiblyObfuscateQuery(CQLStatement statement, String query)
+    private String maybeObfuscatePassword(CQLStatement statement, String query)
     {
         // Statement might be null as side-effect of failed parsing, originates from QueryMessage#execute
-        return null == statement || statement instanceof AuthenticationStatement ? passwordObfuscator.obfuscate(query) : query;
+        String res;
+
+        if (statement == null)
+            res = PasswordObfuscator.obfuscate(query);
+        else if (statement instanceof AuthenticationStatement)
+            res = ((AuthenticationStatement) statement).obfuscatePassword(query);
+        else
+            res = query;
+
+        return res;

Review comment:
       Funny. I'd swore I replied already to this in the 4.0 PR but I can't find my answer anywhere now.
   
   This is intentional for performance. On branching you want to avoid returning results as this breaks CPU branching optimizations/prediction. You want the construct I used (as per the perf training we did)




-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org