PyCQA / PyCQA/bandit

Option to output violation information of skipped tests/lines

Open
#737 2 comments 0 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

Problem to Solve
Without the complete violation information, we cannot know whether certain tests or lines are being skipped reasonably. This option allows us to make more informed judgements.

Proposed Solution

  1. Our team works with the SARIF output format. Therefore, it's desirable if Bandit could output to SARIF directly when used with the flag -f sarif.
  2. When Bandit is executed with the combination of flags -f sarif and --output-suppression, it should run all lines in a file against not only the tests to include specified via -t (command line) / tests (external command line argument & external configuration file), but also the tests specified to be skipped via -s (command line) / skips (external command line argument & external configuration file).
  3. In the SARIF output of Bandit, aside from the original content it normally contains, there should also be violations caused by "skipped" tests and lines, along with the kind and justification of a skipped test (a.k.a. suppression in SARIF terms). Here is an example:
    image
  4. Ideally every skipped test/line should have an accompanying explanation (justification), as my colleague André stated in #478. We are also willing to contribute to this.

Alternatives
As said in #646, if the SARIF output is planned to be included in the near future, our team would be happy to contribute. If not, we are okay with modifying bandit-sarif-formatter together as well.

Please let us know what you think. Thank you.

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

No files or tests are named in the issue. Start by locating Bandit's current formatter and handling of -t/-s with --output-suppression, then review bandit-sarif-formatter and the SARIF suppression fields cited here. Done means SARIF output includes skipped-test and skipped-line violations with suppression kind and justification while preserving normal output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
security, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.