summaryrefslogtreecommitdiff
path: root/keystoneclient/session.py
diff options
context:
space:
mode:
authorSteve Martinelli <s.martinelli@gmail.com>2017-01-03 09:55:09 -0500
committerDavid Stanek <dstanek@dstanek.com>2017-01-06 23:31:53 +0000
commitaf770f17b705a66bd4292b2a54df46ec5fdaa12b (patch)
tree09ca0bc6550cf6addfd51a1e9e2742be3fba345f /keystoneclient/session.py
parent004450040c38a0df05469b844ba30854b67aabd5 (diff)
downloadpython-keystoneclient-af770f17b705a66bd4292b2a54df46ec5fdaa12b.tar.gz
Do not log binary data during request
Do not log binary data during debug logging of a session. Replace the binary data with the string <binary_data> instead. sort of a backport of: I5184002f3a21c5e0ee510b21b9a7884c8dccd1e3 Change-Id: I07ddbc3967f297597542f1975004d94c490f6e6b Related-Bug: 1616105
Diffstat (limited to 'keystoneclient/session.py')
-rw-r--r--keystoneclient/session.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/keystoneclient/session.py b/keystoneclient/session.py
index 41bb124..5c027b8 100644
--- a/keystoneclient/session.py
+++ b/keystoneclient/session.py
@@ -201,6 +201,11 @@ class Session(object):
% self._process_header(header))
if data:
+ if isinstance(data, six.binary_type):
+ try:
+ data = data.decode("ascii")
+ except UnicodeDecodeError:
+ data = "<binary_data>"
string_parts.append("-d '%s'" % data)
try:
logger.debug(' '.join(string_parts))