You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bv...@apache.org on 2021/01/07 17:03:02 UTC

[camel] branch sensitive-utils updated (1a539a8 -> 285c6d3)

This is an automated email from the ASF dual-hosted git repository.

bvahdat pushed a change to branch sensitive-utils
in repository https://gitbox.apache.org/repos/asf/camel.git.


 discard 1a539a8  make use of HashSet#contains instead of streaming + regex which is slower
     add 566c16f  Regen for commit 767e963e2084899ed4043f22cc8ed5346342dfaf
     new 285c6d3  make use of HashSet#contains instead of streaming + regex which is slower

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (1a539a8)
            \
             N -- N -- N   refs/heads/sensitive-utils (285c6d3)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../resources/org/apache/camel/catalog/docs/activemq-component.adoc   | 4 ++--
 .../resources/org/apache/camel/catalog/docs/amqp-component.adoc       | 4 ++--
 .../resources/org/apache/camel/component/activemq/activemq.json       | 4 ++--
 components/camel-activemq/src/main/docs/activemq-component.adoc       | 4 ++--
 .../src/generated/resources/org/apache/camel/component/amqp/amqp.json | 4 ++--
 components/camel-amqp/src/main/docs/amqp-component.adoc               | 4 ++--
 .../camel/builder/component/dsl/ActivemqComponentBuilderFactory.java  | 2 +-
 .../camel/builder/component/dsl/AmqpComponentBuilderFactory.java      | 2 +-
 .../apache/camel/builder/endpoint/dsl/AMQPEndpointBuilderFactory.java | 4 ++--
 .../camel/builder/endpoint/dsl/ActiveMQEndpointBuilderFactory.java    | 4 ++--
 docs/components/modules/ROOT/pages/activemq-component.adoc            | 4 ++--
 docs/components/modules/ROOT/pages/amqp-component.adoc                | 4 ++--
 12 files changed, 22 insertions(+), 22 deletions(-)


[camel] 01/01: make use of HashSet#contains instead of streaming + regex which is slower

Posted by bv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bvahdat pushed a commit to branch sensitive-utils
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 285c6d3bc49b5edea6a9b39b4ff742c780b1c74b
Author: Babak Vahdat <bv...@apache.org>
AuthorDate: Thu Jan 7 17:45:42 2021 +0100

    make use of HashSet#contains instead of streaming + regex which is slower
---
 .../src/main/java/org/apache/camel/util/SensitiveUtils.java      | 9 ++++++---
 .../src/test/java/org/apache/camel/util/SensitiveUtilsTest.java  | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/core/camel-util/src/main/java/org/apache/camel/util/SensitiveUtils.java b/core/camel-util/src/main/java/org/apache/camel/util/SensitiveUtils.java
index 9854fec..ae7691f 100644
--- a/core/camel-util/src/main/java/org/apache/camel/util/SensitiveUtils.java
+++ b/core/camel-util/src/main/java/org/apache/camel/util/SensitiveUtils.java
@@ -18,17 +18,20 @@
 package org.apache.camel.util;
 
 import java.util.Arrays;
+import java.util.HashSet;
 import java.util.Locale;
+import java.util.Set;
 
 public final class SensitiveUtils {
-    public static final String SENSITIVE_KEYS
-            = "passphrase|password|secretkey|accesstoken|clientsecret|authorizationtoken|sasljaasconfig|accesskey";
+    public static final Set<String> SENSITIVE_KEYS = new HashSet<>(
+            Arrays.asList("passphrase", "password", "secretkey", "accesstoken", "clientsecret", "authorizationtoken",
+                    "sasljaasconfig", "accesskey"));
 
     private SensitiveUtils() {
 
     }
 
     public static boolean containsSensitive(String text) {
-        return Arrays.stream(SENSITIVE_KEYS.split("\\|")).anyMatch(s -> text.toLowerCase(Locale.ENGLISH).contains(s));
+        return SENSITIVE_KEYS.contains(text.toLowerCase(Locale.ENGLISH));
     }
 }
diff --git a/core/camel-util/src/test/java/org/apache/camel/util/SensitiveUtilsTest.java b/core/camel-util/src/test/java/org/apache/camel/util/SensitiveUtilsTest.java
index 08fd28e..90ace7f 100644
--- a/core/camel-util/src/test/java/org/apache/camel/util/SensitiveUtilsTest.java
+++ b/core/camel-util/src/test/java/org/apache/camel/util/SensitiveUtilsTest.java
@@ -26,7 +26,7 @@ class SensitiveUtilsTest {
     @Test
     void testContainsSensitive() {
         assertTrue(SensitiveUtils.containsSensitive("accessKey"));
-        assertTrue(SensitiveUtils.containsSensitive("accesskey"));
+        assertTrue(SensitiveUtils.containsSensitive("passphrase"));
     }
 
 }