#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 hashlash):
I think `force_bytes` is only used by `PBKDF2PasswordHasher` and
`PBKDF2SHA1PasswordHasher` through `django.utils.crypto.pbkdf2`. Some
Django's included hashers depend on `hashlib` library while others depend
on third party libraries using `_load_library()` method for password
encoding. Examples:
-
[https://github.com/django/django/blob/fc0fa72ff4cdbf5861a366e31cb8bbacd44da22d/django/contrib/auth/hashers.py#L303-L314
Argon2PasswordHasher]
-
[https://github.com/django/django/blob/fc0fa72ff4cdbf5861a366e31cb8bbacd44da22d/django/contrib/auth/hashers.py#L407-L417
BCryptSHA256PasswordHasher]
-
[https://github.com/django/django/blob/fc0fa72ff4cdbf5861a366e31cb8bbacd44da22d/django/contrib/auth/hashers.py#L613-L619
CryptPasswordHasher]
As Simon Charette said, it is hasher specific. So if we want to make it
language agnostic, I think the first option will do (adding `if not
isinstance(password, (bytes, str))` in `make_password`)
--
Ticket URL: <https://code.djangoproject.com/ticket/31375#comment:5>
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.aea577f76b91f0075ed8009c5dc0e162%40djangoproject.com.