#28207: Bug in contrib.auth.authenticate
-------------------------------------+-------------------------------------
               Reporter:  Tamas      |          Owner:  nobody
  Szabo                              |
                   Type:             |         Status:  new
  Uncategorized                      |
              Component:  Core       |        Version:  1.11
  (Management commands)              |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Django 1.11 introduced the new `request` positional argument for the
 `authenticate` method.

 Unfortunately, it looks like the implementation has a bug. The credentials
 parameter received by the function can be mutated to adapt the keyword
 arguments when calling the backend:

 
https://github.com/django/django/blob/master/django/contrib/auth/__init__.py#L92

 However, the variable isn't reset at the top of the loop (like `args` is)
 so the following backend(s) will be processed as if `request` was in the
 `**credentials`` dictionary.

 As a result both

 
https://github.com/django/django/blob/master/django/contrib/auth/__init__.py#L72
 and
 
https://github.com/django/django/blob/master/django/contrib/auth/__init__.py#L77

 will always fail with type errors, because the `request` argument is
 passed in twice into them.

--
Ticket URL: <https://code.djangoproject.com/ticket/28207>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.76057db05d8d727daf7076900ae6b4a5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to