From 74aa7d80bcf7105437f7e674e2b3c33563530e78 Mon Sep 17 00:00:00 2001 From: DBT Date: Wed, 25 Feb 2026 07:30:38 +0000 Subject: [PATCH] separate telegram private and group allowlist checks --- pkg/channels/telegram.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/channels/telegram.go b/pkg/channels/telegram.go index 2c99ae3..8afe249 100644 --- a/pkg/channels/telegram.go +++ b/pkg/channels/telegram.go @@ -334,7 +334,11 @@ func (c *TelegramChannel) Send(ctx context.Context, msg bus.OutboundMessage) err return nil } -func (c *TelegramChannel) isAllowedChat(chatID int64) bool { +func (c *TelegramChannel) isAllowedChat(chatID int64, chatType string) bool { + // Private chats are governed by allow_from (sender allowlist), not allow_chats. + if strings.TrimSpace(chatType) == telego.ChatTypePrivate { + return true + } if len(c.config.AllowChats) == 0 { return true } @@ -458,7 +462,7 @@ func (c *TelegramChannel) handleMessage(runCtx context.Context, message *telego. content = "[empty message]" } - if !c.isAllowedChat(chatID) { + if !c.isAllowedChat(chatID, message.Chat.Type) { logger.WarnCF("telegram", "Telegram message rejected by chat allowlist", map[string]interface{}{ logger.FieldSenderID: senderID, logger.FieldChatID: chatID,