Use secure sha256 instead of sha1
Fix for bandit B303: Use of insecure MD2, MD4, MD5, or SHA1 hash function. Change-Id: I00403d7bd3b40ae00420e6cddcf40f45488284a9 Partial-Bug: #1759250 (cherry picked from commitab426a791a) (cherry picked from commit62f4868e6e)
This commit is contained in:
committed by
Akihiro Motoki
parent
08a26a00f2
commit
450039b7f9
@@ -183,9 +183,9 @@ def http_log_req(_logger, args, kwargs):
|
||||
for (key, value) in six.iteritems(kwargs['headers']):
|
||||
if key in SENSITIVE_HEADERS:
|
||||
v = value.encode('utf-8')
|
||||
h = hashlib.sha1(v)
|
||||
h = hashlib.sha256(v)
|
||||
d = h.hexdigest()
|
||||
value = "{SHA1}%s" % d
|
||||
value = "{SHA256}%s" % d
|
||||
header = ' -H "%s: %s"' % (key, value)
|
||||
string_parts.append(header)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user