PyCQA / PyCQA/bandit

Optionally output all issues regardless of configured levels

Open
#341 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Is your feature request related to a problem? Please describe.

Yes. Currently, when running bandit at more strict levels, e.g., bandit -lll -iii ..., the pass/fail status of the run will be evaluated based on the results at the higher level and confidence, but issues at lower levels and confidences are effectively ignored outside of showing up in the count of run metrics. For example, I have a codebase that has one issue showing up at -lll -iii and 22 issues that only exist at -l —I'd like to know about all of them, but only fail (return non-zero) on the ones at the level I've configured.

I've briefly looked into writing a more verbose formatter, but it looks like details for issues are only kept if they're at the configured level, so I don't think I can just have it print out everything. Currently I'm thinking about running bandit -lll -iii and reporting our status on that and then also running bandit -l -i but ignoring the exit code just to get a full log.

Describe the solution you'd like

Ideally a flag exists, or perhaps this is a utilization of the --verbose flag, that enables issues of all severities and confidences to be logged while continuing to only set an exit code of the cli based on the requested severity/confidence.

Describe alternatives you've considered

As mentioned before, I looked at writing a verbose formatter, but it doesn't look like that'd do the trick. It seems like perhaps a change would have to happen in the manager first before formatters could do something with the issue list to decide whether or not to log them.

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 tracing how configured severity and confidence levels are handled by the manager and how formatters receive issue details. Check the existing verbose option and CLI exit-status path first. Done means all severity and confidence findings can be logged while the exit code still reflects the requested thresholds.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.