Merge ~cjwatson/launchpad:basic-auth-password-bytes into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: c40b35abe7c8a1002bead6b8205e2c026d421b0b
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:basic-auth-password-bytes
Merge into: launchpad:master
Diff against target: 14 lines (+2/-1)
1 file modified
lib/lp/services/webapp/authentication.py (+2/-1)
Reviewer Review Type Date Requested Status
Cristian Gonzalez (community) Approve
Review via email: mp+396657@code.launchpad.net

Commit message

Treat basic auth password as bytes

Description of the change

zope.publisher.http.HTTPRequest._authUserPW decodes the username and password in a basic auth header to bytes, so we must compare the password that way.

To post a comment you must log in.
Revision history for this message
Cristian Gonzalez (cristiangsp) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/lib/lp/services/webapp/authentication.py b/lib/lp/services/webapp/authentication.py
index 81a2384..c778407 100644
--- a/lib/lp/services/webapp/authentication.py
+++ b/lib/lp/services/webapp/authentication.py
@@ -69,7 +69,8 @@ class PlacelessAuthUtility:
69 principal = login_src.getPrincipalByLogin(login)69 principal = login_src.getPrincipalByLogin(login)
70 if principal is not None and principal.person.is_valid_person:70 if principal is not None and principal.person.is_valid_person:
71 password = credentials.getPassword()71 password = credentials.getPassword()
72 if password == config.launchpad.basic_auth_password:72 if (password ==
73 config.launchpad.basic_auth_password.encode('ASCII')):
73 # We send a LoggedInEvent here, when the74 # We send a LoggedInEvent here, when the
74 # cookie auth below sends a PrincipalIdentified,75 # cookie auth below sends a PrincipalIdentified,
75 # as the login form is never visited for BasicAuth.76 # as the login form is never visited for BasicAuth.

Subscribers

People subscribed via source and target branches

to status/vote changes: