Skip to content

Commit

Permalink
#68 hide sensitive config data from log message
Browse files Browse the repository at this point in the history
  • Loading branch information
justb4 committed May 3, 2018
1 parent b83006b commit 956d3a7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion stetl/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,4 +485,12 @@ def get_dict(self, name=None, default=None):
return result

def to_string(self):
return repr(self.config_dict)
# Need to hide some sensitive values, usually used for logging
safe_copy = self.config_dict.copy()
hides = ['passw', 'pasw', 'token', 'user']
for key in safe_copy:
for hide_key in hides:
if hide_key in key.lower():
safe_copy[key] = '<hidden>'

return repr(safe_copy)

0 comments on commit 956d3a7

Please sign in to comment.