camel git commit: CAMEL-8607 Fixed the issue of Camel endpoint RAW password unsafe characters
Repository: camel Updated Branches: refs/heads/master c68c78215 - f5098d138 CAMEL-8607 Fixed the issue of Camel endpoint RAW password unsafe characters Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f5098d13 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f5098d13 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f5098d13 Branch: refs/heads/master Commit: f5098d13847933d8e2fc185bdad1e67366840bfb Parents: c68c782 Author: Willem Jiang willem.ji...@gmail.com Authored: Thu Apr 23 16:22:27 2015 +0800 Committer: Willem Jiang willem.ji...@gmail.com Committed: Thu Apr 23 16:22:27 2015 +0800 -- .../main/java/org/apache/camel/impl/DefaultComponent.java| 3 ++- .../apache/camel/component/http4/HttpEndpointURLTest.java| 8 2 files changed, 10 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/f5098d13/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java index a832e4d..c7ab7ff 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java +++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java @@ -64,7 +64,8 @@ public abstract class DefaultComponent extends ServiceSupport implements Compone String encodedUri = UnsafeUriCharactersEncoder.encode(uri); if (!encodedUri.equals(uri)) { // uri supplied is not really valid -LOG.warn(Supplied URI '{}' contains unsafe characters, please check encoding, uri); +// we just don't want to log the password setting here +LOG.warn(Supplied URI '{}' contains unsafe characters, please check encoding, URISupport.sanitizeUri(uri)); } return encodedUri; } http://git-wip-us.apache.org/repos/asf/camel/blob/f5098d13/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java -- diff --git a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java index af09699..c86e5a6b 100644 --- a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java +++ b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java @@ -18,6 +18,7 @@ package org.apache.camel.component.http4; import org.apache.camel.ResolveEndpointFailedException; import org.apache.camel.test.junit4.CamelTestSupport; +import org.apache.camel.util.URISupport; import org.apache.http.conn.HttpClientConnectionManager; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.junit.Test; @@ -61,5 +62,12 @@ public class HttpEndpointURLTest extends CamelTestSupport { assertEquals(Get a wrong setting of maxTotalConnections, 40, poolManager.getMaxTotal()); assertEquals(Get a wrong setting of connectionsPerRoute, 5, poolManager.getDefaultMaxPerRoute()); } + +@Test +// Just for CAMEL-8607 +public void testRawWithUnsafeCharacters() throws Exception { +HttpEndpoint http1 = context.getEndpoint(http4://www.google.com?authenticationPreemptive=trueauthPassword=RAW(foo%bar)authUsername=RAW(username), HttpEndpoint.class); +assertTrue(The password is not loggged, URISupport.sanitizeUri(http1.getEndpointUri()).indexOf(authPassword=xx) 0); +} }
[2/2] camel git commit: CAMEL-8607 Fixed the issue of Camel endpoint RAW password unsafe characters
CAMEL-8607 Fixed the issue of Camel endpoint RAW password unsafe characters Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3e041ab5 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3e041ab5 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3e041ab5 Branch: refs/heads/camel-2.14.x Commit: 3e041ab5c0ccf051ba019cfff347f91a38b04516 Parents: 46c52d2 Author: Willem Jiang willem.ji...@gmail.com Authored: Thu Apr 23 16:22:27 2015 +0800 Committer: Willem Jiang willem.ji...@gmail.com Committed: Thu Apr 23 16:23:15 2015 +0800 -- .../main/java/org/apache/camel/impl/DefaultComponent.java| 3 ++- .../apache/camel/component/http4/HttpEndpointURLTest.java| 8 2 files changed, 10 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/3e041ab5/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java index bad9b0c..a3b19d0 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java +++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java @@ -64,7 +64,8 @@ public abstract class DefaultComponent extends ServiceSupport implements Compone String encodedUri = UnsafeUriCharactersEncoder.encode(uri); if (!encodedUri.equals(uri)) { // uri supplied is not really valid -LOG.warn(Supplied URI '{}' contains unsafe characters, please check encoding, uri); +// we just don't want to log the password setting here +LOG.warn(Supplied URI '{}' contains unsafe characters, please check encoding, URISupport.sanitizeUri(uri)); } return encodedUri; } http://git-wip-us.apache.org/repos/asf/camel/blob/3e041ab5/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java -- diff --git a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java index af09699..c86e5a6b 100644 --- a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java +++ b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java @@ -18,6 +18,7 @@ package org.apache.camel.component.http4; import org.apache.camel.ResolveEndpointFailedException; import org.apache.camel.test.junit4.CamelTestSupport; +import org.apache.camel.util.URISupport; import org.apache.http.conn.HttpClientConnectionManager; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.junit.Test; @@ -61,5 +62,12 @@ public class HttpEndpointURLTest extends CamelTestSupport { assertEquals(Get a wrong setting of maxTotalConnections, 40, poolManager.getMaxTotal()); assertEquals(Get a wrong setting of connectionsPerRoute, 5, poolManager.getDefaultMaxPerRoute()); } + +@Test +// Just for CAMEL-8607 +public void testRawWithUnsafeCharacters() throws Exception { +HttpEndpoint http1 = context.getEndpoint(http4://www.google.com?authenticationPreemptive=trueauthPassword=RAW(foo%bar)authUsername=RAW(username), HttpEndpoint.class); +assertTrue(The password is not loggged, URISupport.sanitizeUri(http1.getEndpointUri()).indexOf(authPassword=xx) 0); +} }
[1/2] camel git commit: CAMEL-8607 Fixed the issue of Camel endpoint RAW password unsafe characters
Repository: camel Updated Branches: refs/heads/camel-2.14.x 46c52d24f - 3e041ab5c refs/heads/camel-2.15.x 24fc1a67b - d409c4874 CAMEL-8607 Fixed the issue of Camel endpoint RAW password unsafe characters Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d409c487 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d409c487 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d409c487 Branch: refs/heads/camel-2.15.x Commit: d409c487416921117345a213a2c846eb36964033 Parents: 24fc1a6 Author: Willem Jiang willem.ji...@gmail.com Authored: Thu Apr 23 16:22:27 2015 +0800 Committer: Willem Jiang willem.ji...@gmail.com Committed: Thu Apr 23 16:23:03 2015 +0800 -- .../main/java/org/apache/camel/impl/DefaultComponent.java| 3 ++- .../apache/camel/component/http4/HttpEndpointURLTest.java| 8 2 files changed, 10 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/d409c487/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java index a832e4d..c7ab7ff 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java +++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java @@ -64,7 +64,8 @@ public abstract class DefaultComponent extends ServiceSupport implements Compone String encodedUri = UnsafeUriCharactersEncoder.encode(uri); if (!encodedUri.equals(uri)) { // uri supplied is not really valid -LOG.warn(Supplied URI '{}' contains unsafe characters, please check encoding, uri); +// we just don't want to log the password setting here +LOG.warn(Supplied URI '{}' contains unsafe characters, please check encoding, URISupport.sanitizeUri(uri)); } return encodedUri; } http://git-wip-us.apache.org/repos/asf/camel/blob/d409c487/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java -- diff --git a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java index af09699..c86e5a6b 100644 --- a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java +++ b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointURLTest.java @@ -18,6 +18,7 @@ package org.apache.camel.component.http4; import org.apache.camel.ResolveEndpointFailedException; import org.apache.camel.test.junit4.CamelTestSupport; +import org.apache.camel.util.URISupport; import org.apache.http.conn.HttpClientConnectionManager; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.junit.Test; @@ -61,5 +62,12 @@ public class HttpEndpointURLTest extends CamelTestSupport { assertEquals(Get a wrong setting of maxTotalConnections, 40, poolManager.getMaxTotal()); assertEquals(Get a wrong setting of connectionsPerRoute, 5, poolManager.getDefaultMaxPerRoute()); } + +@Test +// Just for CAMEL-8607 +public void testRawWithUnsafeCharacters() throws Exception { +HttpEndpoint http1 = context.getEndpoint(http4://www.google.com?authenticationPreemptive=trueauthPassword=RAW(foo%bar)authUsername=RAW(username), HttpEndpoint.class); +assertTrue(The password is not loggged, URISupport.sanitizeUri(http1.getEndpointUri()).indexOf(authPassword=xx) 0); +} }