Skip to content

Commit 3df9798

Browse files
committed
Use bandit via flake8
1 parent 627e4ce commit 3df9798

File tree

6 files changed

+17
-34
lines changed

6 files changed

+17
-34
lines changed

.flake8

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@ exclude =
77
test_imports.py,
88
hypothesis-python/tests/py2/*,
99
test_lambda_formatting.py
10-
ignore = D1,D205,D209,D213,D400,D401,D412,D413,D999,D202,E203,E501,W503,B008,B011
10+
ignore =
11+
# `black` creates these ones
12+
E203,E501,W503,
13+
# Various codes from flake8-docstrings we don't care for
14+
D1,D205,D209,D213,D400,D401,D412,D413,D999,D202,
15+
# flake8-bugbear options we disagree with
16+
B008,B011,
17+
# flake8-bandit security warnings we disagree with or don't mind
18+
S101,S102,S105,S110,S307,S311,S404,S6
1119

1220
# Use flake8-alfred to forbid builtins that require compatibility wrappers.
1321
warn-symbols=

hypothesis-python/tests/nocover/test_strategy_state.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def filtered_strategy(s, source, level, mixer):
116116
def is_good(x):
117117
return bool(
118118
Random(
119-
hashlib.md5((mixer + repr(x)).encode(u"utf-8")).digest()
119+
hashlib.sha384((mixer + repr(x)).encode(u"utf-8")).digest()
120120
).randint(0, level)
121121
)
122122

@@ -162,7 +162,7 @@ def flatmapped_strategy(self, source, result1, result2, mixer, p):
162162

163163
def do_map(value):
164164
rep = repr(value)
165-
random = Random(hashlib.md5((mixer + rep).encode(u"utf-8")).digest())
165+
random = Random(hashlib.sha384((mixer + rep).encode(u"utf-8")).digest())
166166
if random.random() <= p:
167167
return result1
168168
else:

requirements/tools.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
attrs
22
autoflake
3-
bandit
43
black
54
blacken-docs
65
coverage
76
django
87
dpcontracts
98
flake8
109
flake8-alfred
10+
flake8-bandit
1111
flake8-bugbear
1212
flake8-docstrings
1313
ipython

requirements/tools.txt

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ attrs==19.3.0
1111
autoflake==1.3.1
1212
babel==2.7.0 # via sphinx
1313
backcall==0.1.0 # via ipython
14-
bandit==1.6.2
14+
bandit==1.6.2 # via flake8-bandit
1515
black==19.10b0
1616
blacken-docs==1.3.0
1717
bleach==3.1.0 # via readme-renderer
@@ -28,8 +28,10 @@ dpcontracts==0.6.0
2828
entrypoints==0.3 # via flake8
2929
filelock==3.0.12 # via tox
3030
flake8-alfred==1.1.1
31+
flake8-bandit==2.1.2
3132
flake8-bugbear==19.8.0
3233
flake8-docstrings==1.5.0
34+
flake8-polyfill==1.0.2 # via flake8-bandit
3335
flake8==3.7.9
3436
gitdb2==2.0.6 # via gitpython
3537
gitpython==3.0.4 # via bandit
@@ -60,7 +62,7 @@ pluggy==0.13.0 # via pytest, tox
6062
prompt-toolkit==2.0.10 # via ipython
6163
ptyprocess==0.6.0 # via pexpect
6264
py==1.8.0 # via pytest, tox
63-
pycodestyle==2.5.0 # via flake8
65+
pycodestyle==2.5.0 # via flake8, flake8-bandit
6466
pydocstyle==4.0.1 # via flake8-docstrings
6567
pyflakes==2.1.1 # via autoflake, flake8
6668
pygithub==1.44 # via pyupio

tooling/scripts/tool-hash.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
import sys
2424

2525
if __name__ == "__main__":
26-
print(hashlib.sha1(sys.stdin.read().encode("utf-8")).hexdigest()[:10])
26+
print(hashlib.sha384(sys.stdin.read().encode("utf-8")).hexdigest()[:10])

whole-repo-tests/test_security.py

-27
This file was deleted.

0 commit comments

Comments
 (0)