Merge pull request #283 from ThomasWaldmann/fix-auth-decode
api basic auth - ignore non-utf8 chars, fixes #282
This commit is contained in:
commit
8b594c8042
@ -121,7 +121,10 @@ def basic_authenticate(auth):
|
|||||||
authmeth, auth = auth.split(' ', 1)
|
authmeth, auth = auth.split(' ', 1)
|
||||||
if authmeth.lower() != 'basic':
|
if authmeth.lower() != 'basic':
|
||||||
return
|
return
|
||||||
auth = base64.b64decode(auth.strip()).decode('utf-8')
|
# we ignore bytes that do not decode. username (hostname) and password
|
||||||
|
# (update secret) both have to be ascii, everything else is a configuration
|
||||||
|
# error on user side.
|
||||||
|
auth = base64.b64decode(auth.strip()).decode('utf-8', errors='ignore')
|
||||||
username, password = auth.split(':', 1)
|
username, password = auth.split(':', 1)
|
||||||
return username, password
|
return username, password
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user