From b85301d59f075b08e3c3cb09d812b91faf8a4b2c Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Thu, 14 Apr 2022 04:26:35 -0400 Subject: [PATCH] Don't log contents of RPC calls It was asking for trouble --- matrix_appservice_kakaotalk/kt/client/client.py | 7 ++----- matrix_appservice_kakaotalk/rpc/rpc.py | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/matrix_appservice_kakaotalk/kt/client/client.py b/matrix_appservice_kakaotalk/kt/client/client.py index 460d685..285ea59 100644 --- a/matrix_appservice_kakaotalk/kt/client/client.py +++ b/matrix_appservice_kakaotalk/kt/client/client.py @@ -127,7 +127,7 @@ class Client: @classmethod async def register_device(cls, passcode: str, **req: JSON) -> None: """Register a (fake) device that will be associated with the provided login credentials.""" - await cls._api_request_void("register_device", passcode=passcode, is_secret=True, **req) + await cls._api_request_void("register_device", passcode=passcode, **req) @classmethod async def login(cls, **req: JSON) -> OAuthCredential: @@ -136,7 +136,7 @@ class Client: Must have first called register_device with these credentials. """ # NOTE Actually returns an auth LoginData, but this only needs an OAuthCredential - return await cls._api_request_result(OAuthCredential, "login", is_secret=True, **req) + return await cls._api_request_result(OAuthCredential, "login", **req) # endregion @@ -358,9 +358,6 @@ class Client: width=width, height=height, ext=ext, - # Don't log the bytes - # TODO Disable logging per-argument, not per-command - is_secret=True ) async def delete_chat( diff --git a/matrix_appservice_kakaotalk/rpc/rpc.py b/matrix_appservice_kakaotalk/rpc/rpc.py index 59c9fcc..f3edb5f 100644 --- a/matrix_appservice_kakaotalk/rpc/rpc.py +++ b/matrix_appservice_kakaotalk/rpc/rpc.py @@ -295,11 +295,11 @@ class RPCClient: except: self.log.exception("Failed to handle incoming request %s", line_str) - async def _raw_request(self, command: str, is_secret: bool = False, **data: JSON) -> asyncio.Future[JSON]: + async def _raw_request(self, command: str, **data: JSON) -> asyncio.Future[JSON]: req_id = self._next_req_id future = self._response_waiters[req_id] = self.loop.create_future() req = {"id": req_id, "command": command, **data} - self.log.debug("Request %d: %s %s", req_id, command, data if not is_secret else "") + self.log.debug("Request %d: %s", req_id, command) assert self._writer is not None self._writer.write(json.dumps(req).encode("utf-8")) self._writer.write(b"\n")