PyCQA / PyCQA/bandit

Make all tests configurable like test plugins.

Open
#943 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
8.3k
Forks
836
Avg merge
5d 3h
Merged PRs (30d)
1

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the configuration guidance at bandit.readthedocs.io/en/latest/config.html and the plugin index, then run the provided command with a YAML configuration containing B311 skips. Done means non-test and test plugins both accept equivalent per-file skip settings, including the B311 example, and the documented behavior works.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
security, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.