Personal Telegram developer console for GitHub
security: require Telegram bot token at webhook boundary
davoodmehraban89 committed
Oct 2, 2026 at 22:51 UTC
e3fb9e9e34e4fa01e6aa24aded01d00c22680a51
1 file changed
+5
-1
src/index.js
+5
-1
@@ -20,7 +20,7 @@ function isOwnerUpdate(update, env) {
20
* Security invariants:
21
* - Telegram webhook requests must carry the configured secret header.
22
* - Telegram updates are owner-only and unauthorized senders are ignored silently.
23
- * - Missing security configuration fails closed.
23
+ * - Missing security or transport configuration fails closed.
24
*/
25
export default {
26
async fetch(request, env = {}, ctx = {}) {
@@ -59,6 +59,10 @@ export default {
59
return new Response('Owner not configured', { status: 503 });
60
}
61
62
+ if (!env.TELEGRAM_BOT_TOKEN) {
63
+ return new Response('Telegram bot token not configured', { status: 503 });
64
+ }
65
+
66
try {
67
const update = await request.json();
68