← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1384409] Re: UnicodeDecodeError when trying to create a user with DEBUG logging turned on

 

** Changed in: keystone
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Keystone.
https://bugs.launchpad.net/bugs/1384409

Title:
  UnicodeDecodeError when trying to create a user with DEBUG logging
  turned on

Status in OpenStack Identity (Keystone):
  Fix Released
Status in The Oslo library incubator:
  Invalid

Bug description:
  The mask_password function of openstack.common.log and/or
  openstack.common.strutils (depending on OpenStack version) seems to
  choke on unicode characters. This actually prevents proper function
  when logging level is set to DEBUG.

  When submitting a POST request to create a user with the unicode
  snowman character in the name (for testing purposes), I get the
  following traceback:

  2014-10-22 18:12:01.973 21263 DEBUG keystone.common.wsgi [-] ******************** REQUEST BODY ******************** _call_ /usr/lib/python2.7/dist-packages/keystone/common/wsgi.py:430
  2014-10-22 18:12:01.974 21263 ERROR keystone.common.wsgi [-] 'ascii' codec can't decode byte 0xe2 in position 36: ordinal not in range(128)
  2014-10-22 18:12:01.974 21263 TRACE keystone.common.wsgi Traceback (most recent call last):
  2014-10-22 18:12:01.974 21263 TRACE keystone.common.wsgi File "/usr/lib/python2.7/dist-packages/keystone/common/wsgi.py", line 396, in _call_
  2014-10-22 18:12:01.974 21263 TRACE keystone.common.wsgi response = request.get_response(self.application)
  2014-10-22 18:12:01.974 21263 TRACE keystone.common.wsgi File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
  2014-10-22 18:12:01.974 21263 TRACE keystone.common.wsgi application, catch_exc_info=False)
  2014-10-22 18:12:01.974 21263 TRACE keystone.common.wsgi File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
  2014-10-22 18:12:01.974 21263 TRACE keystone.common.wsgi app_iter = application(self.environ, start_response)
  2014-10-22 18:12:01.974 21263 TRACE keystone.common.wsgi File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in _call_
  2014-10-22 18:12:01.974 21263 TRACE keystone.common.wsgi return resp(environ, start_response)
  2014-10-22 18:12:01.974 21263 TRACE keystone.common.wsgi File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in _call_
  2014-10-22 18:12:01.974 21263 TRACE keystone.common.wsgi resp = self.call_func(req, *args, **self.kwargs)
  2014-10-22 18:12:01.974 21263 TRACE keystone.common.wsgi File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
  2014-10-22 18:12:01.974 21263 TRACE keystone.common.wsgi return self.func(req, *args, **kwargs)
  2014-10-22 18:12:01.974 21263 TRACE keystone.common.wsgi File "/usr/lib/python2.7/dist-packages/keystone/common/wsgi.py", line 432, in _call_
  2014-10-22 18:12:01.974 21263 TRACE keystone.common.wsgi LOG.debug('%s', log.mask_password(line))
  2014-10-22 18:12:01.974 21263 TRACE keystone.common.wsgi File "/usr/lib/python2.7/dist-packages/keystone/openstack/common/log.py", line 266, in mask_password
  2014-10-22 18:12:01.974 21263 TRACE keystone.common.wsgi message = six.text_type(message)
  2014-10-22 18:12:01.974 21263 TRACE keystone.common.wsgi UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 36: ordinal not in range(128)

  That trace is from an Icehouse install, but the code in mask_password
  appears to suffer the same issue in Juno.

  A simpler repro case:

  >>> from keystone.openstack.common.log import mask_password
  >>> mask_password('"password": "foo"')
  u'"password": "***"'
  >>> mask_password('"password": "f☃o"')
  Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/keystone/openstack/common/log.py", line 266, in mask_password
  message = six.text_type(message)
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 14: ordinal not in range(128)

To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1384409/+subscriptions


References