Edgewall Software
Modify

Opened 3 years ago

Closed 3 years ago

#13467 closed defect (fixed)

Basic authentication failing when colon characters are used in password

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.4.4
Component: web frontend/tracd Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fix basic authention when colon characters are used in password.

API Changes:
Internal Changes:

Description

I noticed that BasicAuthentication.do_auth has an issue in splitting by colon character while working of #13464. In fact, the basic authentication is failing when colon characters are used in the password.

  • trac/web/auth.py

    diff --git a/trac/web/auth.py b/trac/web/auth.py
    index 77744babc..8363bcb0c 100644
    a b class BasicAuthentication(PasswordFileAuthentication):  
    365365    def do_auth(self, environ, start_response):
    366366        header = environ.get('HTTP_AUTHORIZATION')
    367367        if header and header.startswith('Basic'):
    368             auth = b64decode(header[6:]).split(':')
     368            auth = b64decode(header[6:]).split(':', 1)
    369369            if len(auth) == 2:
    370370                user, password = auth
    371371                if self.test(user, password):

Attachments (0)

Change History (3)

comment:2 by Ryan J Ollos, 3 years ago

Looks good to me.

comment:3 by Jun Omae, 3 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Thanks for the reviewing. Committed and merged in [17576-17579].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.