[Django] #21248: Password tests failure on Django 1.5 (bcrypt related)

5 views
Skip to first unread message

Django

unread,
Oct 9, 2013, 6:51:05 AM10/9/13
to django-...@googlegroups.com
#21248: Password tests failure on Django 1.5 (bcrypt related)
------------------------------+--------------------
Reporter: akaariai | Owner: nobody
Type: Bug | Status: new
Component: contrib.auth | Version: 1.5
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------
I get this failure when running Django's test suite on stable/1.5.x (at
commit f8393edb52e3dc73185f2496bfa08463fa4ffa09):
{{{
======================================================================
ERROR: test_bcrypt (django.contrib.auth.tests.hashers.TestUtilsHashPass)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/akaariai/Programming/py27_venv/local/lib/python2.7/site-
packages/django/contrib/auth/tests/hashers.py", line 100, in test_bcrypt
self.assertTrue(check_password('lètmein', encoded))
File "/home/akaariai/Programming/py27_venv/local/lib/python2.7/site-
packages/django/contrib/auth/hashers.py", line 55, in check_password
is_correct = hasher.verify(password, encoded)
File "/home/akaariai/Programming/py27_venv/local/lib/python2.7/site-
packages/django/contrib/auth/hashers.py", line 293, in verify
return constant_time_compare(data,
bcrypt.hashpw(force_bytes(password), data))
File "/home/akaariai/Programming/py27_venv/local/lib/python2.7/site-
packages/bcrypt/__init__.py", line 91, in hashpw
raise TypeError("Unicode-objects must be encoded before hashing")
TypeError: Unicode-objects must be encoded before hashing
}}}

The failure happens only when bcrypt is installed. Tested bcrypt
1.0.0-1.0.2. The failure happens both on Python 2.7 and 3.2. It seems the
error is there in first 1.5 release, too. The error isn't present in
1.6.x.

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

Django

unread,
Oct 9, 2013, 7:32:08 AM10/9/13
to django-...@googlegroups.com
#21248: Password tests failure on Django 1.5 (bcrypt related)
------------------------------+--------------------------------------

Reporter: akaariai | Owner: nobody
Type: Bug | Status: new
Component: contrib.auth | Version: 1.5
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
------------------------------+--------------------------------------
Changes (by akaariai):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Django 1.5.x doesn't work with bcrypt, only with py-bcrypt (confirmed by
dstufft). Skipping the test_bcrypt test for bcrypt library (but not py-
bcrypt) seems good enough for now.

[https://github.com/akaariai/django/commit/7c88676c0d551dd2632783b0c4f2e24e9c4fe425
This commit] seems to skip the test for bcrypt, but not for py-bcrypt.

--
Ticket URL: <https://code.djangoproject.com/ticket/21248#comment:1>

Django

unread,
Oct 9, 2013, 7:42:51 AM10/9/13
to django-...@googlegroups.com
#21248: Password tests failure on Django 1.5 (bcrypt related)
------------------------------+--------------------------------------
Reporter: akaariai | Owner: nobody
Type: Bug | Status: closed
Component: contrib.auth | Version: 1.5
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by Anssi Kääriäinen <akaariai@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"9f8a36eb20895d9e542820d5190bfa77ad1b85d9"]:
{{{
#!CommitTicketReference repository=""
revision="9f8a36eb20895d9e542820d5190bfa77ad1b85d9"
[1.5.x] Fixed #21248 -- Skipped test_bcrypt if no py-bcrypt found

Pre 1.6 Django worked only with py-bcrypt, not with bcrypt. Skipped
test_bcrypt when using bcrypt to avoid false positives.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21248#comment:2>

Django

unread,
Oct 9, 2013, 7:46:32 AM10/9/13
to django-...@googlegroups.com
#21248: Password tests failure on Django 1.5 (bcrypt related)
------------------------------+--------------------------------------
Reporter: akaariai | Owner: nobody
Type: Bug | Status: closed
Component: contrib.auth | Version: 1.5
Severity: Normal | Resolution: fixed
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 Anssi Kääriäinen <akaariai@…>):

In [changeset:"037ec1054ca8c08e65307f53e5851fe50ac5e8bf"]:
{{{
#!CommitTicketReference repository=""
revision="037ec1054ca8c08e65307f53e5851fe50ac5e8bf"
[1.4.x] Fixed #21248 -- Skipped test_bcrypt if no py-bcrypt found

Pre 1.6 Django worked only with py-bcrypt, not with bcrypt. Skipped
test_bcrypt when using bcrypt to avoid false positives.

Backpatch of 9f8a36eb20895d9e542820d5190bfa77ad1b85d9 from stable/1.5.x.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21248#comment:3>

Reply all
Reply to author
Forward
0 new messages