Claus Ibsen created CAMEL-27695:
-----------------------------------

             Summary: camel-telegram - TelegramConfiguration.toString() shows 
the authorizationToken
                 Key: CAMEL-27695
                 URL: https://issues.apache.org/jira/browse/CAMEL-27695
             Project: Camel
          Issue Type: Bug
          Components: camel-telegram
            Reporter: Claus Ibsen
             Fix For: 4.24.0


{{TelegramConfiguration.toString()}} prints 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 the configuration shows the token.

Two more places show a secret value in clear text:
* {{TelegramComponent.createEndpoint()}} puts the endpoint URI as is in the 
message of the {{IllegalArgumentException}} for an unsupported endpoint type, 
so an {{authorizationToken}} in the URI query is shown. The URI is not 
sanitized there, as {{DefaultEndpoint.toString()}} does.
* {{SendInvoiceMessage.toString()}} and {{CreateInvoiceLinkMessage.toString()}} 
print the payment {{providerToken}}, and {{TelegramProducer}} logs the outgoing 
message at DEBUG level ({{Message being sent is: ...}}).

The Bot API URL, which carries the token in its path, is already kept out of 
the log lines and exception messages 
({{TelegramServiceRestBotAPIAdapter.describe()}}).

h4. Proposed change
* Mask the {{authorizationToken}} in {{TelegramConfiguration.toString()}} with 
{{xxxxxx}}, as Camel masks secrets, and keep the other fields.
* Sanitize the endpoint URI ({{URISupport.sanitizeUri}}) in the exception 
messages of {{TelegramComponent.createEndpoint()}}.
* Mask a non-empty {{providerToken}} in {{SendInvoiceMessage.toString()}} and 
{{CreateInvoiceLinkMessage.toString()}}.

_Claude Code on behalf of Claus Ibsen_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to