CAMEL-23812: camel-milo better username & password handling#24185
CAMEL-23812: camel-milo better username & password handling#24185robMate wants to merge 3 commits into
Conversation
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
| @UriParam(label = "security") | ||
| private String username; | ||
|
|
||
| @UriParam(label = "security", secret = true) |
There was a problem hiding this comment.
as per https://issues.apache.org/jira/browse/CAMEL-23250 it should be secret = "secret"
davsclaus
left a comment
There was a problem hiding this comment.
Nice work tackling the special-character credential handling — the replaceFirst(user + "@", "") regex approach was genuinely broken and the explicit-parameter alternative is a clean solution.
One blocking item and a couple of minor observations:
Blocking: missing generated files — the new @UriParam fields (username, password) in MiloClientConfiguration should trigger regeneration of the component metadata (src/generated/). The current milo-client.json doesn't contain these params, and the diff doesn't include any generated-file changes. CI will fail with uncommitted generated changes. Please run mvn clean install -DskipTests in the components/camel-milo directory and commit the regenerated files.
Minor observations (non-blocking):
- The endpoint-level
getUsername/setUsername/getPassword/setPassworddelegation methods are not annotated with@UriParam. SinceMiloClientConfigurationalready declares these as@UriParamandconfigurationitself is a@UriParamon the endpoint, Camel's property binding should resolve them through the nested config object — the endpoint-level methods may be redundant. - Discovery URI reconstruction now always runs (even without user info), which is correct but subtly changes from the prior conditional-only modification.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
| this.omitNullValues = omitNullValues; | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
Nit: double blank line here — should be a single blank line per code style.
|
replaced by other PR closing this |
Description
The Camel Milo client component previously embedded authentication credentials directly in the endpoint URI using the format user:password@host.
To prevent Milo from receiving credentials (which it doesn't handle), the component used string manipulation with
discoveryUri.replaceFirst(user + "@", "")to strip credentials from the URL before connection. This caused issues because thereplaceFirst()function uses regex patterns that fail with regex special characters like "$.*", and passwords containing characters like "%" cause issues withjava.net.URLDecoder.decode()due to percent-encoding in URLs.This approach has limitations: it fails when credentials contain special characters commonly found in auto-generated passwords, such as:
@ (breaks URI parsing)
?, & (URI query parameter delimiters)
/, # (URI structure delimiters)
$, % (encoding/variable expansion)
For example, a password like pass@$?&/#% would cause the discovery URI reconstruction to fail or produce incorrect results.
Target
mainbranch)Tracking
Apache Camel coding standards and style
I checked that each commit in the pull request has a meaningful subject line and body.
I have run
mvn clean install -DskipTestslocally from root folder and I have committed all auto-generated changes.