You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/07/28 17:32:11 UTC
[camel] branch camel-3.21.x updated: CAMEL-19676: camel-core: Do not log sensitive endpoint uri, if route … (#10889)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.21.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.21.x by this push:
new 431ed9494ab CAMEL-19676: camel-core: Do not log sensitive endpoint uri, if route … (#10889)
431ed9494ab is described below
commit 431ed9494ab09ce0a366e3a2dbc9191a44283559
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jul 28 19:31:24 2023 +0200
CAMEL-19676: camel-core: Do not log sensitive endpoint uri, if route … (#10889)
CAMEL-19676: camel-core: Do not log sensitive endpoint uri, if route failed to be created.
---
.../java/org/apache/camel/model/SendDefinition.java | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/SendDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/SendDefinition.java
index 66657f8c9d4..c2a1d43636f 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/SendDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/SendDefinition.java
@@ -24,6 +24,7 @@ import javax.xml.bind.annotation.XmlTransient;
import org.apache.camel.Endpoint;
import org.apache.camel.builder.EndpointProducerBuilder;
import org.apache.camel.spi.Metadata;
+import org.apache.camel.util.URISupport;
/**
* Sends the message to an endpoint
@@ -32,6 +33,8 @@ import org.apache.camel.spi.Metadata;
public abstract class SendDefinition<Type extends ProcessorDefinition<Type>> extends NoOutputDefinition<Type>
implements EndpointRequiredDefinition {
+ @XmlTransient
+ private String endpointUriToString;
@XmlTransient
protected Endpoint endpoint;
@XmlTransient
@@ -106,11 +109,23 @@ public abstract class SendDefinition<Type extends ProcessorDefinition<Type>> ext
@Override
public String getLabel() {
- String uri = getEndpointUri();
+ if (endpointUriToString == null) {
+ String value = null;
+ try {
+ value = getEndpointUri();
+ } catch (RuntimeException e) {
+ // ignore any exception and use null for building the string value
+ }
+ // ensure to sanitize uri so we do not show sensitive information such as passwords
+ endpointUriToString = URISupport.sanitizeUri(value);
+ }
+
+ String uri = endpointUriToString;
return uri != null ? uri : "no uri supplied";
}
protected void clear() {
+ this.endpointUriToString = null;
this.endpointProducerBuilder = null;
this.endpoint = null;
this.uri = null;