diff options
author | Alfredo Moralejo <amoralej@redhat.com> | 2019-08-21 17:44:16 +0200 |
---|---|---|
committer | Alfredo Moralejo <amoralej@redhat.com> | 2019-08-21 18:28:09 +0200 |
commit | 5ae7d21f98bc8e6237f600f4885f94e57a2c99b1 (patch) | |
tree | 01bee28424ac8f4e6c0be9dc3ccbc44a80610f84 | |
parent | 1b8bafb391b82665b99b3da8205402ec2cd495d1 (diff) | |
download | oslo-utils-5ae7d21f98bc8e6237f600f4885f94e57a2c99b1.tar.gz |
Add digestmod when using hmac3.41.1
Until Python 3.8 hmc.new() defaulted the digestmod argument to 'hmac-md5'.
This was deperecated, to be removed in Python 3.8 [1], so let's get
ready for new python.
Also switching to more secure sha1 algorithm, using md5 anywhere may
trigger alerts from automatic security tools.
[1] https://docs.python.org/3.8/library/hmac.html
Change-Id: I4b365cb05de98bdd498b3c2094e4a77ab3944b12
-rw-r--r-- | oslo_utils/tests/test_secretutils.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/oslo_utils/tests/test_secretutils.py b/oslo_utils/tests/test_secretutils.py index faea3dd..87f6218 100644 --- a/oslo_utils/tests/test_secretutils.py +++ b/oslo_utils/tests/test_secretutils.py @@ -12,6 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. +import hashlib import hmac from oslotest import base as test_base @@ -23,7 +24,8 @@ from oslo_utils import secretutils class SecretUtilsTest(testscenarios.TestWithScenarios, test_base.BaseTestCase): - _gen_digest = lambda text: hmac.new(b'foo', text.encode('utf-8')).digest() + _gen_digest = lambda text: hmac.new(b'foo', text.encode('utf-8'), + digestmod=hashlib.sha1).digest() scenarios = [ ('binary', {'converter': _gen_digest}), ('unicode', {'converter': lambda text: text}), |