Skip to content

Commit

Permalink
Merge pull request #78 from newerton/fix/telegram-userid
Browse files Browse the repository at this point in the history
fix: vulnerability of another user being able to send message through the bot
  • Loading branch information
newerton authored Feb 2, 2022
2 parents 102e0fc + 3b857d8 commit 79ecb03
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions config/version.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version:
app: "1.5.19"
config_file: "1.5.19"
app: "1.5.20"
config_file: "1.5.20"
emergency: "false"

21 changes: 14 additions & 7 deletions src/services/telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,32 @@ def start(self):
self.bot.set_my_commands(Commands, language_code='en')

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

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

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

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

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

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

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

commands = [
['chat_id', sendChatId],
Expand Down

0 comments on commit 79ecb03

Please sign in to comment.