davsclaus opened a new pull request, #31033:
URL: https://github.com/apache/camel/pull/31033

   JIRA: https://issues.apache.org/jira/browse/CAMEL-27695
   
   ## What was wrong
   
   - `TelegramConfiguration.toString()` printed the `authorizationToken` (the 
bot token, a secret option) in clear text. Camel does not log the configuration 
today, but any log line or debug print of it showed the token.
   - `TelegramComponent.createEndpoint()` put the raw endpoint URI in the 
message of its `IllegalArgumentException`s, so an `authorizationToken` in the 
query (e.g. `telegram:channels?authorizationToken=...`) was shown. 
`DefaultEndpoint.toString()` sanitizes the URI; these messages did not.
   - `SendInvoiceMessage.toString()` and `CreateInvoiceLinkMessage.toString()` 
printed the payment `providerToken`, and `TelegramProducer` logs the outgoing 
message at DEBUG level (`Message being sent is: ...`).
   
   The Bot API URL (which has the token in its path) was already kept out of 
log lines and exception messages by 
`TelegramServiceRestBotAPIAdapter.describe()`, and the webhook warning logs the 
endpoint through its sanitized `toString()`, so nothing changed there.
   
   ## What changed
   
   - `TelegramConfiguration.toString()` masks the token with `xxxxxx` (as Camel 
masks secrets) and keeps the other fields.
   - The two exception messages of `TelegramComponent.createEndpoint()` use 
`URISupport.sanitizeUri(uri)`.
   - `SendInvoiceMessage.toString()` and `CreateInvoiceLinkMessage.toString()` 
mask a non-empty `providerToken`. The empty token of payments in Telegram Stars 
is still shown as `''`.
   
   ## Tests
   
   - `TelegramConfigurationTest.testToStringMasksTheAuthorizationToken`
   - 
`TelegramComponentParametersTest.testWrongTypeDoesNotShowTheAuthorizationToken`
   - `InvoiceMessageToStringTest` (new, 3 tests: both invoice messages, and the 
empty Telegram Stars token)
   
   The 4 masking tests fail without the fix in `src/main` (the Telegram Stars 
test passes either way). The module build passes (133 tests, 0 failures).
   
   No option, header or doc change, so no generated files and no upgrade guide 
entry.
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to