[Django] #31985: salted_hmac incorrect documentation

29 views
Skip to first unread message

Django

unread,
Sep 7, 2020, 2:28:18 AM9/7/20
to django-...@googlegroups.com
#31985: salted_hmac incorrect documentation
-------------------------------------------+------------------------
Reporter: Francisco Couzo | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 3.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
On its documentation, it mentions "any algorithm name supported by
hashlib.new() can be passed",
but this is not true, algorithms supported by hashlib.new() may not
accessible through getattr,
This was mentioned here:
https://github.com/django/django/pull/12291#discussion_r364348132
But it wasn't addressed.

Either we can make salted_hmac use hashlib.new (which is discouraged by
python's documentation).
Or change the documentation to not mentioned hashlib.new.

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

Django

unread,
Sep 7, 2020, 3:00:05 AM9/7/20
to django-...@googlegroups.com
#31985: salted_hmac docstring shouldn't mention hashlib.new().
--------------------------------------+------------------------------------

Reporter: Francisco Couzo | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Utilities | Version: 3.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by felixxm):

* type: Uncategorized => Cleanup/optimization
* component: Uncategorized => Utilities
* easy: 0 => 1
* stage: Unreviewed => Accepted


Comment:

Agreed. I would remove `new()` from the docstring:
{{{
- but any algorithm name supported by hashlib.new() can be passed.
+ but any algorithm name supported by hashlib can be passed.
}}}

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

Django

unread,
Sep 7, 2020, 3:00:41 AM9/7/20
to django-...@googlegroups.com
#31985: salted_hmac() docstring shouldn't mention hashlib.new().
--------------------------------------+------------------------------------

Reporter: Francisco Couzo | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Utilities | Version: 3.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

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

Django

unread,
Sep 7, 2020, 3:03:19 AM9/7/20
to django-...@googlegroups.com
#31985: salted_hmac() docstring shouldn't mention hashlib.new().
-------------------------------------+-------------------------------------
Reporter: Francisco Couzo | Owner: Francisco
Type: | Couzo
Cleanup/optimization | Status: assigned

Component: Utilities | Version: 3.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Francisco Couzo):

* owner: nobody => Francisco Couzo
* status: new => assigned


Comment:

I can make the PR

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

Django

unread,
Sep 7, 2020, 3:18:56 AM9/7/20
to django-...@googlegroups.com
#31985: salted_hmac() docstring shouldn't mention hashlib.new().
-------------------------------------+-------------------------------------
Reporter: Francisco Couzo | Owner: Francisco
Type: | Couzo
Cleanup/optimization | Status: assigned
Component: Utilities | Version: 3.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Francisco Couzo):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/13394 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/31985#comment:4>

Django

unread,
Sep 7, 2020, 5:00:24 AM9/7/20
to django-...@googlegroups.com
#31985: salted_hmac() docstring shouldn't mention hashlib.new().
-------------------------------------+-------------------------------------
Reporter: Francisco Couzo | Owner: Francisco
Type: | Couzo
Cleanup/optimization | Status: closed
Component: Utilities | Version: 3.1
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

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


Comment:

In [changeset:"5ea1621c724e765c9a642a1b3b6e83419fda920b" 5ea1621]:
{{{
#!CommitTicketReference repository=""
revision="5ea1621c724e765c9a642a1b3b6e83419fda920b"
Fixed #31985 -- Corrected salted_hmac()'s docstring about supported
algorithms.

salted_hmac() validates supported algorithms by checking hashlib
methods.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31985#comment:5>

Reply all
Reply to author
Forward
0 new messages