From 0e4c1b71e68a175092456352ebf02a5ea2758ecb Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Tue, 10 May 2022 17:04:39 +0300 Subject: [PATCH] Redact 2fa password when using in-Matrix login --- mautrix_telegram/commands/telegram/auth.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mautrix_telegram/commands/telegram/auth.py b/mautrix_telegram/commands/telegram/auth.py index 50614f1c..b014d5f2 100644 --- a/mautrix_telegram/commands/telegram/auth.py +++ b/mautrix_telegram/commands/telegram/auth.py @@ -38,6 +38,7 @@ from telethon.errors import ( from telethon.tl.types import User from mautrix.client import Client +from mautrix.errors import MForbidden from mautrix.types import ( EventID, ImageInfo, @@ -377,6 +378,10 @@ async def enter_password(evt: CommandEvent) -> EventID | None: "This bridge instance does not allow in-Matrix login. " "Please use `$cmdprefix+sp login` to get login instructions" ) + try: + await evt.az.intent.redact(evt.room_id, evt.event_id) + except MForbidden as e: + evt.log.warning(f"Failed to redact password command: {e}") try: await _sign_in( evt,