Catch unicode decode errors in auth decode

Fixes https://jira.coreos.com/browse/QUAY-1249
This commit is contained in:
Joseph Schorr 2018-12-07 16:16:32 -05:00
parent 72ad0e9789
commit c3f2901ec0
2 changed files with 8 additions and 1 deletions

View file

@ -47,7 +47,7 @@ def _parse_basic_auth_header(auth):
try:
credentials = [part.decode('utf-8') for part in b64decode(normalized[1]).split(':', 1)]
except TypeError:
except (TypeError, UnicodeDecodeError, ValueError):
logger.exception('Exception when parsing basic auth header: %s', auth)
return None, 'Could not parse basic auth header'