From cd5f6a0c56a645f24c708ad21a831968341200ec Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Fri, 3 Jul 2020 20:01:22 +0200 Subject: [PATCH] Don't print MQTT credentials to log (#37364) --- homeassistant/components/mqtt/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/mqtt/__init__.py b/homeassistant/components/mqtt/__init__.py index bb2ec7a8bcb..5f82fa76dfa 100644 --- a/homeassistant/components/mqtt/__init__.py +++ b/homeassistant/components/mqtt/__init__.py @@ -476,10 +476,14 @@ async def async_setup_entry(hass, entry): if conf is None: conf = CONFIG_SCHEMA({DOMAIN: dict(entry.data)})[DOMAIN] elif any(key in conf for key in entry.data): - _LOGGER.warning( + shared_keys = conf.keys() & entry.data.keys() + override = {k: entry.data[k] for k in shared_keys} + if CONF_PASSWORD in override: + override[CONF_PASSWORD] = "********" + _LOGGER.info( "Data in your configuration entry is going to override your " "configuration.yaml: %s", - entry.data, + override, ) conf = _merge_config(entry, conf)