PyCQA / PyCQA/bandit

.bandit ignored for single files

Open
#332 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

When doing a single file, bandit doesn't use the .bandit file in the directory. If it's agreed that it should work like this, I'm happy to do a PR to fix it.

With a config file tests/.bandit, running

bandit -r tests/

has different results than

bandit -r tests/test_cli.py

Expected behavior
I would expect bandit to search each directory to root for a .bandit file and apply the first found to the test run.

Bandit version

bandit 1.4.0

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 reproducing the difference between bandit -r tests/ and bandit -r tests/test_cli.py with the tests/.bandit configuration. Trace the CLI configuration-discovery path, then use tests/test_cli.py for coverage; done means single-file scans apply the expected directory configuration consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, security, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.