diff --git a/services/channel_worker.py b/services/channel_worker.py index 8288c1b1..b5a43cd9 100644 --- a/services/channel_worker.py +++ b/services/channel_worker.py @@ -32,6 +32,11 @@ level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", ) +# python-telegram-bot issues its API calls through httpx, and the bot token +# is part of the request URL. httpx logs a line per request at INFO, so +# leaving it enabled writes the token to the logs in plaintext. +logging.getLogger("httpx").setLevel(logging.WARNING) +logging.getLogger("httpcore").setLevel(logging.WARNING) logger = logging.getLogger("channel_worker") CHANNEL_CONFIG_POLL_INTERVAL_S = float( diff --git a/services/worker_service.py b/services/worker_service.py index 63e8f3d9..f059c818 100644 --- a/services/worker_service.py +++ b/services/worker_service.py @@ -62,6 +62,11 @@ level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", ) +# python-telegram-bot issues its API calls through httpx, and the bot token +# is part of the request URL. httpx logs a line per request at INFO, so +# leaving it enabled writes the token to the logs in plaintext. +logging.getLogger("httpx").setLevel(logging.WARNING) +logging.getLogger("httpcore").setLevel(logging.WARNING) logger = logging.getLogger("heartbeat_worker") POLL_INTERVAL = float(os.getenv("WORKER_POLL_INTERVAL", 1.0))