← Back to team overview

python-jenkins-developers team mailing list archive

[Bug 1039307] Re: Basic auth fails for long usernames/passwords

 

base64.encodestring() always has a trailing newline:

    >>> base64.encodestring("a")
    'YQ==\n'

And indeed split with more newlines with long strings:

    >>> base64.encodestring("oheayhoeiaeoioiaoeiaozeiaozeiazeazeoaieaozieoazieoaeioazie")
    'b2h  ... \nZQ==\n'


Both the 2.6 and 2.7 documentation state that encodestring() is legacy interface so we should just use base64.b64encode()

** Changed in: python-jenkins
       Status: New => Confirmed

-- 
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:
  Confirmed

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