#31375: make_password shouldn't accept values other than bytes or string as an
argument
------------------------------+--------------------------------------
     Reporter:  iamdavidcz    |                    Owner:  nobody
         Type:  Bug           |                   Status:  new
    Component:  contrib.auth  |                  Version:  3.0
     Severity:  Normal        |               Resolution:
     Keywords:                |             Triage Stage:  Unreviewed
    Has patch:  0             |      Needs documentation:  0
  Needs tests:  0             |  Patch needs improvement:  0
Easy pickings:  0             |                    UI/UX:  0
------------------------------+--------------------------------------

Comment (by Simon Charette):

 From a bit of testing it seems `make_password` already raises `TypeError`
 for invalid types on `master`

 {{{#!python
 >>> make_password(1)
 TypeError: can only concatenate str (not "int") to str
 >>> class Object:
         def __str__(self):
             return 'foo'
 >>> make_password(Object())
 TypeError: can only concatenate str (not "Object") to str
 >>> make_password(True)
 TypeError: can only concatenate str (not "bool") to str
 ...
 }}}

 It is hasher specific though so I guess we could turn `not
 instance(password, str)` into a `TypeError` from `make_password` itself
 instead of relying on implementation details of hashers.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31375#comment:2>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.547d1d27589dcdde9bf46024be613684%40djangoproject.com.

Reply via email to