python-jenkins-developers team mailing list archive
-
python-jenkins-developers team
-
Mailing list archive
-
Message #00155
[Bug 1039307] Re: Basic auth fails for long usernames/passwords
Reviewed: https://review.openstack.org/132433
Committed: https://git.openstack.org/cgit/stackforge/python-jenkins/commit/?id=69655cc682bd7974d3319d6d044da17fc2fcb7cc
Submitter: Jenkins
Branch: master
commit 69655cc682bd7974d3319d6d044da17fc2fcb7cc
Author: Antoine Musso <hashar@xxxxxxx>
Date: Sat Nov 1 23:57:22 2014 +0100
fix auth with long username or password
Our auth_headers() helper uses base64.encodestring() which inserts
newlines to generate a nicely formatted text. That is surely helpful for
display purposes but unwanted when forging an authentication string.
encodestring() always append a newline, which was the reason for the
[:-1] slicing.
Switch to base64.b64encoding() and add a test ensuring no newline is
inserted.
Closes-Bug: 1039307
Change-Id: I71c3e6d504a500a1f21ff89b1d54a155da1aaf0e
** Changed in: python-jenkins
Status: In Progress => Fix Committed
--
You received this bug notification because you are a member of Python
Jenkins Developers, which is subscribed to Python Jenkins.
https://bugs.launchpad.net/bugs/1039307
Title:
Basic auth fails for long usernames/passwords
Status in Python API for Jenkins:
Fix Committed
Bug description:
The python base64 encoding adds a newline character every 76 chars.
However, HTTP basic authentication (at least as implemented by
Jenkins) does not accept newlines. This means that the API fails with
long username/passwords because it contains a '\n' in the middle (and
user receives a 403 error).
I have attached a patch that appears to fix this.
To manage notifications about this bug go to:
https://bugs.launchpad.net/python-jenkins/+bug/1039307/+subscriptions
References