Control report severity level separately to exit code
Nobody has claimed this yet.
- 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.
Currently in bandit the minimum severity for reporting and for triggering an exit code of 1 is always the same - controlled by -l, -ll and -lll. This means, for example, that I cannot run bandit in CI with all vulnerabilities going into a report, while failing the CI job on more severe issues.
Describe the solution you'd like
Being able to control the two separately. For example, -lll can still control both, but perhaps having presence of equivalent -L flags overriding what triggers an exit code of 1. So here's my example above in this format:
bandit -r code_dir -l -LLL
Describe alternatives you've considered
I could just run bandit twice: the first time reporting everything with --exit-zero; the second time just reporting high severity and allowing the exit code to influence CI.
Additional context
This is part of how I'd like our CI to work whereby I use the excellent Microsoft open source Bandit SARIF formatter to create a SARIF report, which pushes to Github security issues.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue does not name specific files or tests. Start by locating the CLI handling for -l, -ll, and -lll and the logic that determines the exit status; separate the reporting threshold from the failure threshold, then add coverage for the example where all findings are reported but only high-severity findings fail CI.
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