You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2022/06/06 12:45:36 UTC

[GitHub] [sling-org-apache-sling-resourceresolver] github-code-scanning[bot] commented on a diff in pull request #70: SLING-11343: add metrics related to vanity path lookup and bloom filter behavior

github-code-scanning[bot] commented on code in PR #70:
URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/70#discussion_r890111671


##########
src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java:
##########
@@ -709,10 +718,29 @@
     private List<MapEntry> getMapEntryList(String vanityPath) {
         List<MapEntry> mapEntries = null;
 
-        if (!vanityPathsProcessed.get() || BloomFilterUtils.probablyContains(vanityBloomFilter, vanityPath)) {
+        boolean initFinished = vanityPathsProcessed.get();
+        boolean probablyPresent = false;
+
+        if (initFinished) {
+            // total number of lookups after init (and when cache not complete)
+            this.vanityPathLookups.incrementAndGet();
+
+            // init is done - check the bloom filter
+            probablyPresent = BloomFilterUtils.probablyContains(vanityBloomFilter, vanityPath);
+            log.trace("bloom filter lookup for {} -> {}", vanityPath, probablyPresent);

Review Comment:
   ## Logging should not be vulnerable to injection attacks
   
   <!--SONAR_ISSUE_KEY:AYEVULZxK3ycU8sEOzC0-->Change this code to not log user-controlled data.
   
   [Show more details](https://github.com/apache/sling-org-apache-sling-resourceresolver/security/code-scanning/19)



-- 
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: dev-unsubscribe@sling.apache.org

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