From 86adf093f1891e13bae1fdb57772cd6d6f31c9a3 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 8 Jun 2019 17:02:52 +0300 Subject: [PATCH] Use random device IDs when logging in --- maubot/management/api/client_auth.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/maubot/management/api/client_auth.py b/maubot/management/api/client_auth.py index 899e981..a23083a 100644 --- a/maubot/management/api/client_auth.py +++ b/maubot/management/api/client_auth.py @@ -16,8 +16,10 @@ from typing import Dict, Tuple, NamedTuple, Optional from json import JSONDecodeError from http import HTTPStatus -import hmac import hashlib +import random +import string +import hmac from aiohttp import web from mautrix.api import HTTPAPI, Path, Method @@ -114,7 +116,7 @@ async def login(request: web.Request) -> web.Response: "user": username, }, "password": password, - "device_id": "maubot", + "device_id": f"maubot_{random.choices(string.ascii_uppercase + string.digits, k=8)}", })) except MatrixRequestError as e: return web.json_response({