Skip to content

Commit 3b857d8

Browse files
committed
fix: vulnerability of another user being able to send message through the bot
1 parent 102e0fc commit 3b857d8

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

config/version.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
version:
2-
app: "1.5.19"
3-
config_file: "1.5.19"
2+
app: "1.5.20"
3+
config_file: "1.5.20"
44
emergency: "false"
55

src/services/telegram.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,25 +85,32 @@ def start(self):
8585
self.bot.set_my_commands(Commands, language_code='en')
8686

8787
def sendPrint(update: Update, context: CallbackContext) -> None:
88-
self.commandSendPrint(update)
88+
if f'{update.message.from_user.id}' in self.telegramConfig['chat_ids']:
89+
self.commandSendPrint(update)
8990

9091
def sendChatId(update: Update, context: CallbackContext) -> None:
91-
self.commandSendChatId(update)
92+
if f'{update.message.from_user.id}' in self.telegramConfig['chat_ids']:
93+
self.commandSendChatId(update)
9294

9395
def sendMap(update: Update, context: CallbackContext) -> None:
94-
self.commandSendMap(update)
96+
if f'{update.message.from_user.id}' in self.telegramConfig['chat_ids']:
97+
self.commandSendMap(update)
9598

9699
def sendBcoin(update: Update, context: CallbackContext) -> None:
97-
self.commandSendBcoin(update)
100+
if f'{update.message.from_user.id}' in self.telegramConfig['chat_ids']:
101+
self.commandSendBcoin(update)
98102

99103
def sendDonation(update: Update, context: CallbackContext) -> None:
100-
self.commandSendDonation(update)
104+
if f'{update.message.from_user.id}' in self.telegramConfig['chat_ids']:
105+
self.commandSendDonation(update)
101106

102107
def sendAllHeroesToWork(update: Update, context: CallbackContext) -> None:
103-
self.commandAllHeroesToWork(update)
108+
if f'{update.message.from_user.id}' in self.telegramConfig['chat_ids']:
109+
self.commandAllHeroesToWork(update)
104110

105111
def sendAllHeroesToRest(update: Update, context: CallbackContext) -> None:
106-
self.commandAllHeroesToRest(update)
112+
if f'{update.message.from_user.id}' in self.telegramConfig['chat_ids']:
113+
self.commandAllHeroesToRest(update)
107114

108115
commands = [
109116
['chat_id', sendChatId],

0 commit comments

Comments
 (0)