The vulnerability allows an attacker to forge Telegram webhook requests if the channels.telegram.webhookSecret is not configured. This leads to an authentication bypass. The analysis of the provided patches points to the startTelegramWebhook function in src/telegram/webhook.ts as the central point of the vulnerability.
The commit 633fe8b9c17f02fcc68ecdb5ec212a5ace932f09 introduces a runtime guard directly within startTelegramWebhook. It adds a check to ensure that a secret token is provided before proceeding to set up the webhook. If the secret is missing, it throws an error, preventing the application from starting with an insecure webhook configuration. Before this change, the function would happily start the webhook without a secret, and the underlying grammy library would not perform any authentication on incoming requests, creating the vulnerability.
The other commits provide defense-in-depth. ca92597e1f9593236ad86810b66633144b69314d adds configuration validation to prevent such a setup, 5643a934799dc523ec2ef18c007e1aa2c386b670 changes the default listening interface to localhost to reduce network exposure, and 3cbcba10cf30c2ffb898f0d8c7dfb929f15f8930 adds request body size limits. While these are important security enhancements, the core logic that allows the insecure behavior at runtime is located in startTelegramWebhook.