From 29d51ee78a20a040ccb8e92303575a5c2b557368 Mon Sep 17 00:00:00 2001 From: bobokun Date: Sat, 20 Aug 2022 22:17:51 -0400 Subject: [PATCH] Adds log secrets for hiding sensitive information --- modules/apprise.py | 1 + modules/bhd.py | 3 ++- modules/notifiarr.py | 3 ++- modules/qbittorrent.py | 4 +++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/apprise.py b/modules/apprise.py index d1f8d4d..c20837c 100644 --- a/modules/apprise.py +++ b/modules/apprise.py @@ -7,6 +7,7 @@ class Apprise: def __init__(self, config, params): self.config = config self.api_url = params["api_url"] + logger.secret(self.api_url) self.notify_url = ",".join(params["notify_url"]) response = self.config.get(self.api_url) if response.status_code != 200: diff --git a/modules/bhd.py b/modules/bhd.py index 561f51b..db7fcaf 100644 --- a/modules/bhd.py +++ b/modules/bhd.py @@ -10,6 +10,7 @@ class BeyondHD: def __init__(self, config, params): self.config = config self.apikey = params["apikey"] + logger.secret(self.apikey) json = {"search": "test"} self.search(json) @@ -17,7 +18,7 @@ class BeyondHD: url = f"{base_url}{path}{self.apikey}" json["action"] = "search" if self.config.trace_mode: - logger.debug(url.replace(self.apikey, "APIKEY")) + logger.debug(url) logger.debug(f"JSON: {json}") try: response = self.config.post(url, json=json) diff --git a/modules/notifiarr.py b/modules/notifiarr.py index 3250b37..2f400a5 100644 --- a/modules/notifiarr.py +++ b/modules/notifiarr.py @@ -16,6 +16,7 @@ class Notifiarr: self.develop = params["develop"] self.test = params["test"] self.instance = params["instance"] + logger.secret(self.apikey) url, _ = self.get_url("user/validate/") response = self.config.get(url) response_json = None @@ -38,7 +39,7 @@ class Notifiarr: def get_url(self, path): url = f"{dev_url if self.develop else base_url}{'notification/test' if self.test else f'{path}{self.apikey}'}" if self.config.trace_mode: - logger.debug(url.replace(self.apikey, "APIKEY")) + logger.debug(url) if self.test: params = {"event": f"qbitManage-{self.apikey[:5]}", "qbit_client": self.config.data["qbt"]["host"], "instance": self.instance} else: diff --git a/modules/qbittorrent.py b/modules/qbittorrent.py index f002dd9..a5a7b09 100644 --- a/modules/qbittorrent.py +++ b/modules/qbittorrent.py @@ -18,7 +18,9 @@ class Qbt: self.host = params["host"] self.username = params["username"] self.password = params["password"] - logger.debug(f'Host: {self.host}, Username: {self.username}, Password: {self.password if self.password is None else "[REDACTED]"}') + logger.secret(self.username) + logger.secret(self.password) + logger.debug(f'Host: {self.host}, Username: {self.username}, Password: {self.password}') try: self.client = Client(host=self.host, username=self.username, password=self.password, VERIFY_WEBUI_CERTIFICATE=False) self.client.auth_log_in()