PyCQA / bandit

Bandit is a tool designed to find common security issues in Python code.
https://bandit.readthedocs.io
Apache License 2.0
6.52k stars 612 forks source link

Make all tests configurable like test plugins. #943

Open CTimmerman opened 2 years ago

CTimmerman commented 2 years ago

https://bandit.readthedocs.io/en/latest/config.html says that you can use a YAML configuration to configure test plugins, eg disabling one per file name like so for B101 with python -m bandit -r test -c bandit.yaml:

assert_used:
  skips: ['*_test.py', '*/test_*.py']

Unfortunately, that doesn't work for B311 because that's not a test plugin according to https://bandit.readthedocs.io/en/latest/plugins/index.html

I would like for this to fully work:

assert_used:
  skips: ['*_test.py', '*/test_*.py']

B311:
  skips: ['*_test.py', '*/test_*.py']

That would also solve https://stackoverflow.com/questions/66882491/pybandit-to-allow-b311-pseudo-random-generators-to-be-used-in-tests/73410100