Fix non ascii bytes in password sanitization. This fixes #727

This commit is contained in:
Armin Ronacher 2016-01-21 09:26:31 -08:00
parent 38dd40e80d
commit 54192ad2df
2 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,9 @@
Version 5.10.1
--------------
* Fixed a problem where bytes as keys in dictionaries caused problems
on data sanitization if those bytes were outside of the ASCII range.
Version 5.10.0
--------------

View File

@ -9,7 +9,7 @@ from __future__ import absolute_import
import re
from raven._compat import string_types, text_type
from raven._compat import string_types
from raven.utils import varmap
@ -94,7 +94,12 @@ class SanitizePasswordsProcessor(Processor):
if not key: # key can be a NoneType
return value
key = text_type(key).lower()
# Just in case we have bytes here, we want to make them into text
# properly without failing so we can perform our check.
if isinstance(key, bytes):
key = key.decode('utf-8', 'replace')
key = key.lower()
for field in self.FIELDS:
if field in key:
# store mask as a fixed length for security