Skip to content

Commit

Permalink
add parser formatting to bandit.md (#8757)
Browse files Browse the repository at this point in the history
* add parser formatting to bandit.md

* add parser formatting to bandit.md

---------

Co-authored-by: Paul Osinski <[email protected]>
Co-authored-by: Cody Maffucci <[email protected]>
  • Loading branch information
3 people authored Oct 2, 2023
1 parent 9ec3124 commit 985034b
Showing 1 changed file with 64 additions and 1 deletion.
65 changes: 64 additions & 1 deletion docs/content/en/integrations/parsers/file/bandit.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,67 @@
title: "Bandit"
toc_hide: true
---
JSON report format

### File Types
DefectDojo parser accepts a .json file.

To export a .json file from Bandit, you will need to install and run the .json report formatter from your Bandit instance.
See Bandit documentation: https://bandit.readthedocs.io/en/latest/formatters/index.html


### Acceptable JSON Format
All properties are expected as strings, except "metrics" properties, which are expected as numbers. All properties are required by the parser.

~~~
{
"errors": [],
"generated_at": "example-timestamp",
"metrics": {
"_totals": {
"CONFIDENCE.HIGH": 1.0,
"CONFIDENCE.LOW": 0.0,
"CONFIDENCE.MEDIUM": 0.0,
"CONFIDENCE.UNDEFINED": 0.0,
"SEVERITY.HIGH": 0.0,
"SEVERITY.LOW": 1.0,
"SEVERITY.MEDIUM": 0.0,
"SEVERITY.UNDEFINED": 0.0,
"loc": 2,
"nosec": 0
},
"one/one.py": {
"CONFIDENCE.HIGH": 1.0,
"CONFIDENCE.LOW": 0.0,
"CONFIDENCE.MEDIUM": 0.0,
"CONFIDENCE.UNDEFINED": 0.0,
"SEVERITY.HIGH": 0.0,
"SEVERITY.LOW": 1.0,
"SEVERITY.MEDIUM": 0.0,
"SEVERITY.UNDEFINED": 0.0,
"loc": 2,
"nosec": 0
}
...
},
"results": [
{
"code": "1 import os\n2 assert False\n",
"filename": "example.filename",
"issue_confidence": "example_confidence",
"issue_severity": "example_severity",
"issue_text": "Example issue description.",
"line_number": 2,
"line_range": [
2
],
"more_info": "https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
}
...
]
}
~~~

### Sample Scan Data
Sample Bandit scans can be found at https://github.com/DefectDojo/sample-scan-files/tree/master/bandit.

0 comments on commit 985034b

Please sign in to comment.