Claus Ibsen created CAMEL-24253:
-----------------------------------
Summary: Endpoint DSL mangles + and % characters in option values
Key: CAMEL-24253
URL: https://issues.apache.org/jira/browse/CAMEL-24253
Project: Camel
Issue Type: Bug
Components: camel-endpointdsl
Reporter: Claus Ibsen
When using the Endpoint DSL (e.g. {{sftp(...).password("sec+ret")}}) values
containing {{+}} or {{%}} characters are silently mangled to spaces during the
URI encoding/decoding round-trip.
This is a regression introduced in 4.14.0 by CAMEL-22293 which changed
{{AbstractEndpointBuilder.resolve()}} to resolve endpoints from the URI string
alone, removing the safety net where raw properties overwrote values parsed
from the URI.
The root cause is a double-decode: {{URLEncoder}} encodes {{+}} as {{%2B}},
{{URI.getQuery()}} percent-decodes it back to literal {{+}}, then
{{URLDecoder.decode()}} interprets that {{+}} as a space.
This affects any endpoint option value containing {{+}} or {{%}} when set via
the Endpoint DSL, including SFTP knownHosts (SSH public keys contain {{+}}),
passwords, SQL queries, etc.
The fix is to automatically wrap values containing {{+}} or {{%}} in {{RAW()}}
when building the URI string in
{{AbstractEndpointBuilder.computeProperties()}}, so the URI parser preserves
the value verbatim.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)