mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-12-22 12:40:17 +00:00
Redact sensitive info from debug logs (#1069)
Redacts sensitive data when debug logging device responses such as mac, location and usernames
This commit is contained in:
@@ -50,7 +50,6 @@ import logging
|
||||
import secrets
|
||||
import struct
|
||||
import time
|
||||
from pprint import pformat as pf
|
||||
from typing import Any, cast
|
||||
|
||||
from cryptography.hazmat.primitives import padding
|
||||
@@ -353,7 +352,7 @@ class KlapTransport(BaseTransport):
|
||||
+ f"request with seq {seq}"
|
||||
)
|
||||
else:
|
||||
_LOGGER.debug("Query posted " + msg)
|
||||
_LOGGER.debug("Device %s query posted %s", self._host, msg)
|
||||
|
||||
# Check for mypy
|
||||
if self._encryption_session is not None:
|
||||
@@ -361,11 +360,7 @@ class KlapTransport(BaseTransport):
|
||||
|
||||
json_payload = json_loads(decrypted_response)
|
||||
|
||||
_LOGGER.debug(
|
||||
"%s << %s",
|
||||
self._host,
|
||||
_LOGGER.isEnabledFor(logging.DEBUG) and pf(json_payload),
|
||||
)
|
||||
_LOGGER.debug("Device %s query response received", self._host)
|
||||
|
||||
return json_payload
|
||||
|
||||
|
||||
Reference in New Issue
Block a user