Bandit: Remove bandit B324 from skip list
Remove B324 (prohibit list calls: md5, sha1 for python>=3.9) from bandit skip list, for this replace sha1 with blake2b. Change-Id: Iafe571ad0de0408414ed321f4b9e9588916a873d
This commit is contained in:
parent
4cad0eda59
commit
d782a868d7
@ -2464,8 +2464,8 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
|
||||
return '%08x' % addr
|
||||
else:
|
||||
# Create 32-bit Base32 encoded hash
|
||||
sha1 = hashlib.sha1(ip_address.encode())
|
||||
iphash = base64.b32encode(sha1.digest())
|
||||
blake2b = hashlib.blake2b(ip_address.encode(), digest_size=20)
|
||||
iphash = base64.b32encode(blake2b.digest())
|
||||
return iphash[:hashlen].decode().lower()
|
||||
except Exception:
|
||||
LOG.warning("Invalid remote IP: %s", ip_address)
|
||||
|
@ -4510,12 +4510,12 @@ class TestOvsAgentTunnelName(base.BaseTestCase):
|
||||
|
||||
def test_get_tunnel_name_vxlan_ipv6(self):
|
||||
self.assertEqual(
|
||||
'vxlan-pehtjzksi',
|
||||
'vxlan-qtfsbtdew',
|
||||
ovs_agent.OVSNeutronAgent.get_tunnel_name(
|
||||
'vxlan', '2001:db8::1', '2001:db8::2'))
|
||||
|
||||
def test_get_tunnel_name_gre_ipv6(self):
|
||||
self.assertEqual(
|
||||
'gre-pehtjzksiqr',
|
||||
'gre-qtfsbtdewtq',
|
||||
ovs_agent.OVSNeutronAgent.get_tunnel_name(
|
||||
'gre', '2001:db8::1', '2001:db8::2'))
|
||||
|
3
tox.ini
3
tox.ini
@ -222,9 +222,8 @@ import_exceptions = neutron._i18n
|
||||
[testenv:bandit]
|
||||
deps = {[testenv:pep8]deps}
|
||||
# B104: Possible binding to all interfaces
|
||||
# B324: prohibit list calls: md5, sha1 for python>=3.9
|
||||
# B604: any_other_function_with_shell_equals_true
|
||||
commands = bandit -r neutron -x tests -n5 -s B104,B324,B604
|
||||
commands = bandit -r neutron -x tests -n5 -s B104,B604
|
||||
|
||||
[testenv:bashate]
|
||||
deps = {[testenv:pep8]deps}
|
||||
|
Loading…
Reference in New Issue
Block a user