Skip to content

Commit cd1a412

Browse files
author
Matt Riedemann
committed
Mask passwords in debug logs for auth_config_hook
The auth config hook can have credentials in it so we have to mask the config before logging it. To avoid doing the work of masking the password if we aren't going to log it, there is a conditional put around the actual debug statement. Change-Id: I8e626672ec94fc837610216bccb4354dbdedca17 Closes-Bug: #1630822
1 parent bfeecd5 commit cd1a412

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

openstackclient/common/client_config.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
from os_client_config import config
1919
from os_client_config import exceptions as occ_exceptions
20+
from oslo_utils import strutils
21+
import six
2022

2123

2224
LOG = logging.getLogger(__name__)
@@ -180,7 +182,9 @@ def auth_config_hook(self, config):
180182
config = self._auth_v2_ignore_v3(config)
181183
config = self._auth_default_domain(config)
182184

183-
LOG.debug("auth_config_hook(): %s" % config)
185+
if LOG.isEnabledFor(logging.DEBUG):
186+
LOG.debug("auth_config_hook(): %s",
187+
strutils.mask_password(six.text_type(config)))
184188
return config
185189

186190
def load_auth_plugin(self, config):

0 commit comments

Comments
 (0)