From ca765a05ad8ed2ac035677cc712eb8167d91f995 Mon Sep 17 00:00:00 2001 From: Svein Seldal Date: Tue, 22 Oct 2024 20:48:15 +0200 Subject: [PATCH] Fix redaction of username and password in logs (#132) --- custom_components/zaptec/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/custom_components/zaptec/__init__.py b/custom_components/zaptec/__init__.py index 37d68d4..4110e13 100644 --- a/custom_components/zaptec/__init__.py +++ b/custom_components/zaptec/__init__.py @@ -69,8 +69,13 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up zaptec as config entry.""" + redacted_data = {**entry.data} + for key in ("password", "username"): + if key in redacted_data: + redacted_data[key] = "********" + _LOGGER.info(STARTUP) - _LOGGER.debug("Setting up entry %s: %s", entry.entry_id, entry.data) + _LOGGER.debug("Setting up entry %s: %s", entry.entry_id, redacted_data) coordinator = ZaptecUpdateCoordinator( hass,