Andrea Cosentino created CAMEL-25564:
----------------------------------------

             Summary: camel-telegram - verify the Bot API secret token on 
webhook updates
                 Key: CAMEL-25564
                 URL: https://issues.apache.org/jira/browse/CAMEL-25564
             Project: Camel
          Issue Type: Improvement
          Components: camel-telegram
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino
             Fix For: 4.24.0, 4.18.6, 4.22.2


In webhook mode, camel-telegram registers the webhook by calling {{setWebhook}} 
with the {{url}} parameter only. The Bot API's {{setWebhook}} also accepts a 
{{secret_token}} parameter, which Telegram sends back in the 
{{X-Telegram-Bot-Api-Secret-Token}} header of every webhook request.

Add support for it:
* add an endpoint option for the secret token, with a default derived from the 
bot token, so the value stays the same across restarts and replicas;
* pass the token to {{setWebhook}} when the webhook is registered;
* in {{TelegramWebhookProcessor}}, answer a request whose header does not match 
with HTTP 403, without passing it to the route;
* document the option in the webhook mode section, and add an upgrade-guide 
note for deployments that register the webhook themselves 
({{webhookAutoRegister=false}}).

This mirrors the inbound webhook verification of camel-clickup and the 
{{webhookSecret}} option of camel-whatsapp.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to