Hi Flo and Pasquale,

A bit late to notice the thread. Actually, I'd argue that this is not a
bug. If you use RAW(...) and ")&" in the middle like your case:

    ?password=RAW(41)&fail)

there should be no way to syntactically parse the query uniquely. Parsing
it as a single "password" key with value "41)&fail" is a valid way, but
also parsing it as two params of password = "41" and no value key "fail)"
can be valid. Let's see another example. How do we parse this query?

    ?param1=RAW(abc)&param2=RAW(def)

Is it param1 = "abc)&param2=RAW(def)" or param1 = "abc" and param2 = "def"?

With CAMEL-12982 what we provide for such a case as using a password
containing ")&" is to use RAW{...} instead of RAW(...).

    ?password=RAW{41)&fail}

For more detail on RAW() vs RAW{} I wrote an explanation here:
https://issues.apache.org/jira/browse/CAMEL-12982?focusedCommentId=16744700&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-16744700

On Mon, Jul 26, 2021 at 12:52 AM EIBL Florian (ICS460-BAI) <
florian.e...@spar-ics.com> wrote:

> Hi Pasquale,
>
> thank you for the support. In the meantime I got a new password for the
> SFTP user from the server provider without the problematic char sequence.
> This seems to be the safest solution for me.
>
> But pls let me know if you found the problem and if you could fix it.
>
>
> Regards,
> Flo
>
> -----Ursprüngliche Nachricht-----
> Von: Pasquale Congiusti <pasquale.congiu...@gmail.com>
> Gesendet: Mittwoch, 21. Juli 2021 17:22
> An: users@camel.apache.org
> Betreff: {EXT} Re: SFTP component possible bug with URL parameter
> including char sequence “)&”
>
> I think a possible workaround while we figure out how to fix it is to
> provide two RAW functions wrapping the ) character:
>
> RAW(41))RAW(&fail)
>
> You may give it a try.
>
> Pasquale.
>
> On Wed, Jul 21, 2021 at 5:10 PM Pasquale Congiusti <
> pasquale.congiu...@gmail.com> wrote:
>
> > Ah, I see. The problem is how we can escape the ")" character, as this
> > is interpreted as closing the RAW function.
> >
> > I think it may be even a bug with some greedy regular expression problem.
> > I've opened a Jira issue to track the problem [1], we'll be working on
> > the fix soon unless there is already any escape character available (I
> > tried the classic \ with no success).
> >
> > [1] https://issues.apache.org/jira/browse/CAMEL-16813
> >
> > Pasquale.
> >
> > On Wed, Jul 21, 2021 at 1:24 PM EIBL Florian (ICS460-BAI) <
> > florian.e...@spar-ics.com> wrote:
> >
> >> Hi,
> >>
> >> thanks for your recommendation, but it does not work.
> >>
> >> I tried to URL encode the password: 41%29%26fail
> >>
> >> With the encoded password, I do not get the “Failed to resolve endpoint”
> >> error below, but the password is wrong when connecting to the server.
> >> It seems that the password is not URL decoded before it is used by
> >> the Camel SftpConsumer and hence it is wrong.
> >>
> >> Any ideas?
> >>
> >>
> >> Thx and regards,
> >> Flo
> >>
> >> Von: Pasquale Congiusti <pasquale.congiu...@gmail.com>
> >> Gesendet: Freitag, 16. Juli 2021 16:37
> >> An: users@camel.apache.org
> >> Betreff: {EXT} Re: SFTP component possible bug with URL parameter
> >> including char sequence “)&”
> >>
> >> Hi there,
> >> you can try to urlencode the problematic characters and see if it
> solves.
> >>
> >> Pasquale.
> >>
> >> On Fri, Jul 16, 2021 at 12:39 PM EIBL Florian (ICS460-BAI) <
> >> florian.e...@spar-ics.com<mailto:florian.e...@spar-ics.com>> wrote:
> >> Hello,
> >>
> >> I‘m using Camel v3.10.0 and openjdk 14.0.1
> >>
> >> Camel has a problem building this route:
> >>
> >>
> >> <https://www.spar-ics.com/>
> >>
> >> Florian EIBL
> >> Software Engineer
> >> Business Automation & Integration
> >> Phone:
> >> +43 664 6259733
> >> Mobile:
> >> +43 664 6259733
> >> E-Mail:
> >> florian.e...@spar-ics.com<mailto:florian.e...@spar-ics.com>
> >>
> >> SPAR Business Services GmbH
> >> Information & Communication Services
> >> Europastrasse 3, 5015 Salzburg, Austria
> >>
> >>
> >> _____________________________________________________________________
> >> _______________________________
> >>
> >> from("sftp:testserver/../testdir/" +
> >>                 "?password=RAW(41)&fail)")
> >>         .log("${body}");
> >>
> >> _____________________________________________________________________
> >> _______________________________
> >>
> >> It seems that parsing the endpoint URL is a problem, if there is the
> >> char sequence “)&” in the password.  It does not help to use RAW()
> >> syntax for the password (moreover Camel does it anyway).
> >> The chars following “)&” are interpreted as a new URL parameter ->
> >> “Check the uri if the parameters are spelt correctly and that they
> >> are properties of the endpoint. Unknown parameters=[{fail=}]”
> >>
> >> Here the complete stacktrace:
> >>
> >> StackTrace:
> >> org.apache.camel.FailedToCreateRouteException: Failed to create route
> >> route1: Route(route1)[From[sftp:testserver/../testdir/?password=xxxx...
> >> because of Failed to resolve endpoint:
> >> sftp://testserver/../testdir/?fail%29=&password=xxxxxx due to: Failed
> >> to resolve endpoint:
> >> sftp://testserver/../testdir/?fail%29=&password=xxxxxx
> >> due to: There are 1 parameters that couldn't be set on the endpoint.
> >> Check the uri if the parameters are spelt correctly and that they are
> >> properties of the endpoint. Unknown parameters=[{fail)=}]
> >>                 at
> >> org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:8
> >> 0) ~[camel-core-reifier-3.10.0.jar:3.10.0]
> >>                 at
> >> org.apache.camel.impl.DefaultModelReifierFactory.createRoute(DefaultM
> >> odelReifierFactory.java:49) ~[camel-core-engine-3.10.0.jar:3.10.0]
> >>                 at
> >> org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(Defau
> >> ltCamelContext.java:826) ~[camel-core-engine-3.10.0.jar:3.10.0]
> >>                 at
> >> org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(Defau
> >> ltCamelContext.java:716) ~[camel-core-engine-3.10.0.jar:3.10.0]
> >>                 at
> >> org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCame
> >> lContext.java:2756) ~[camel-base-engine-3.10.0.jar:3.10.0]
> >>                 at
> >> org.apache.camel.support.service.BaseService.init(BaseService.java:83
> >> )
> >> ~[camel-api-3.10.0.jar:3.10.0]
> >>                 at
> >> org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelC
> >> ontext.java:2475) ~[camel-base-engine-3.10.0.jar:3.10.0]
> >>                 at
> >> org.apache.camel.support.service.BaseService.start(BaseService.java:1
> >> 11)
> >> ~[camel-api-3.10.0.jar:3.10.0]
> >>                 at
> >> org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamel
> >> Context.java:2494) ~[camel-base-engine-3.10.0.jar:3.10.0]
> >>                 at
> >> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.j
> >> ava:245) ~[camel-core-engine-3.10.0.jar:3.10.0]
> >>                 at
> >> org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.j
> >> ava:107)
> >> ~[camel-spring-3.10.0.jar:3.10.0]
> >>                 at
> >> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringC
> >> amelContext.java:139)
> >> ~[camel-spring-3.10.0.jar:3.10.0]
> >>                 at
> >> org.springframework.context.event.SimpleApplicationEventMulticaster.d
> >> oInvokeListener(SimpleApplicationEventMulticaster.java:172)
> >> ~[spring-context-5.3.2.jar:5.3.2]
> >>                 at
> >> org.springframework.context.event.SimpleApplicationEventMulticaster.i
> >> nvokeListener(SimpleApplicationEventMulticaster.java:165)
> >> ~[spring-context-5.3.2.jar:5.3.2]
> >>                 at
> >> org.springframework.context.event.SimpleApplicationEventMulticaster.m
> >> ulticastEvent(SimpleApplicationEventMulticaster.java:139)
> >> ~[spring-context-5.3.2.jar:5.3.2]
> >>                 at
> >> org.springframework.context.support.AbstractApplicationContext.publis
> >> hEvent(AbstractApplicationContext.java:426)
> >> ~[spring-context-5.3.2.jar:5.3.2]
> >>                 at
> >> org.springframework.context.support.AbstractApplicationContext.publis
> >> hEvent(AbstractApplicationContext.java:383)
> >> ~[spring-context-5.3.2.jar:5.3.2]
> >>                 at
> >> org.springframework.context.support.AbstractApplicationContext.finish
> >> Refresh(AbstractApplicationContext.java:943)
> >> ~[spring-context-5.3.2.jar:5.3.2]
> >>                 at
> >> org.springframework.context.support.AbstractApplicationContext.refres
> >> h(AbstractApplicationContext.java:591)
> >> ~[spring-context-5.3.2.jar:5.3.2]
> >>                 at
> >> org.springframework.boot.web.servlet.context.ServletWebServerApplicat
> >> ionContext.refresh(ServletWebServerApplicationContext.java:144)
> >> ~[spring-boot-2.4.1.jar:2.4.1]
> >>                 at
> >> org.springframework.boot.SpringApplication.refresh(SpringApplication.
> >> java:767)
> >> ~[spring-boot-2.4.1.jar:2.4.1]
> >>                 at
> >> org.springframework.boot.SpringApplication.refresh(SpringApplication.
> >> java:759)
> >> ~[spring-boot-2.4.1.jar:2.4.1]
> >>                 at
> >> org.springframework.boot.SpringApplication.refreshContext(SpringAppli
> >> cation.java:426)
> >> ~[spring-boot-2.4.1.jar:2.4.1]
> >>                 at
> >> org.springframework.boot.SpringApplication.run(SpringApplication.java
> >> :326)
> >> ~[spring-boot-2.4.1.jar:2.4.1]
> >>                 at
> >> org.springframework.boot.SpringApplication.run(SpringApplication.java
> >> :1309)
> >> ~[spring-boot-2.4.1.jar:2.4.1]
> >>                 at
> >> org.springframework.boot.SpringApplication.run(SpringApplication.java
> >> :1298)
> >> ~[spring-boot-2.4.1.jar:2.4.1]
> >>                 at
> >> com.spar_ics.eai.apps.routes.idm_scim_service.IdmScimServiceApplicati
> >> on.main(IdmScimServiceApplication.java:13)
> >> ~[classes/:na]
> >> Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
> >> resolve endpoint:
> >> sftp://testserver/../testdir/?fail%29=&password=xxxxxx
> >> due to: Failed to resolve endpoint:
> >> sftp://testserver/../testdir/?fail%29=&password=xxxxxx due to: There
> >> are 1 parameters that couldn't be set on the endpoint. Check the uri
> >> if the parameters are spelt correctly and that they are properties of
> >> the endpoint. Unknown parameters=[{fail)=}]
> >>                 at
> >> org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(Abstr
> >> actCamelContext.java:962) ~[camel-base-engine-3.10.0.jar:3.10.0]
> >>                 at
> >> org.apache.camel.impl.engine.AbstractCamelContext.getEndpoint(Abstrac
> >> tCamelContext.java:844) ~[camel-base-engine-3.10.0.jar:3.10.0]
> >>                 at
> >> org.apache.camel.support.CamelContextHelper.getMandatoryEndpoint(Came
> >> lContextHelper.java:58)
> >> ~[camel-support-3.10.0.jar:3.10.0]
> >>                 at
> >> org.apache.camel.reifier.AbstractReifier.resolveEndpoint(AbstractReif
> >> ier.java:177) ~[camel-core-reifier-3.10.0.jar:3.10.0]
> >>                 at
> >> org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java
> >> :94) ~[camel-core-reifier-3.10.0.jar:3.10.0]
> >>                 at
> >> org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:7
> >> 4) ~[camel-core-reifier-3.10.0.jar:3.10.0]
> >>                 ... 26 common frames omitted Caused by:
> >> org.apache.camel.ResolveEndpointFailedException: Failed to resolve
> >> endpoint: sftp://testserver/../testdir/?fail%29=&password=xxxxxx
> >> due to: There are 1 parameters that couldn't be set on the endpoint.
> >> Check the uri if the parameters are spelt correctly and that they are
> >> properties of the endpoint. Unknown parameters=[{fail)=}]
> >>                 at
> >> org.apache.camel.support.DefaultComponent.validateParameters(DefaultC
> >> omponent.java:299)
> >> ~[camel-support-3.10.0.jar:3.10.0]
> >>                 at
> >> org.apache.camel.support.DefaultComponent.createEndpoint(DefaultCompo
> >> nent.java:192)
> >> ~[camel-support-3.10.0.jar:3.10.0]
> >>                 at
> >> org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(Abstr
> >> actCamelContext.java:928) ~[camel-base-engine-3.10.0.jar:3.10.0]
> >>                 ... 31 common frames omitted
> >>
> >>
> >>
> >> Thx and regards,
> >> Flo
> >> Sollten Sie diese E-Mail unbeabsichtigt bzw. irrtümlich erhalten
> >> haben, so weisen wir Sie darauf hin, dass gemäß § 93 Abs 4 TKG der
> >> Inhalt sowie die Tatsache des Empfangs dieser E-Mail weder
> >> aufgezeichnet noch verwertet oder Unbefugten mitgeteilt werden
> >> dürfen. Wir ersuchen Sie, die Nachricht von Ihrem System zu löschen
> >> und sich mit uns in Verbindung zu setzen. If you have received this
> >> email accidentally or in error, we point out that, in accordance with
> >> § 93 para. 4 TKG (Telecommunications Act), the contents of this email
> >> and the fact of its receipt must not be recorded, exploited or
> >> communicated to unauthorized persons. We ask you to delete the message
> from your system and to contact us.
> >>
> >
>


-- 
Tadayoshi Sato

Reply via email to