diff options
| author | Matt Riedemann <mriedem@us.ibm.com> | 2016-10-05 21:11:16 -0400 |
|---|---|---|
| committer | Matt Riedemann <mriedem@us.ibm.com> | 2016-10-05 21:11:16 -0400 |
| commit | cd1a412408f068aeef97c1ee368400307fce7733 (patch) | |
| tree | c18957f6d8abdcec5d1f44d18e4c21235d99afef /openstackclient/common | |
| parent | bfeecd50fdb8f1475d51ac662eb09514a1754345 (diff) | |
| download | python-openstackclient-cd1a412408f068aeef97c1ee368400307fce7733.tar.gz | |
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
Diffstat (limited to 'openstackclient/common')
| -rw-r--r-- | openstackclient/common/client_config.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/openstackclient/common/client_config.py b/openstackclient/common/client_config.py index 30286df8..d6297753 100644 --- a/openstackclient/common/client_config.py +++ b/openstackclient/common/client_config.py @@ -17,6 +17,8 @@ import logging from os_client_config import config from os_client_config import exceptions as occ_exceptions +from oslo_utils import strutils +import six LOG = logging.getLogger(__name__) @@ -180,7 +182,9 @@ class OSC_Config(config.OpenStackConfig): config = self._auth_v2_ignore_v3(config) config = self._auth_default_domain(config) - LOG.debug("auth_config_hook(): %s" % config) + if LOG.isEnabledFor(logging.DEBUG): + LOG.debug("auth_config_hook(): %s", + strutils.mask_password(six.text_type(config))) return config def load_auth_plugin(self, config): |
