-
-
Notifications
You must be signed in to change notification settings - Fork 677
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
I'm running bandit with pre-commit. I want to dump the report in a json format so that I can exploit it afterward.
For some unknown reason, the json generated is broken at the end, in a random way at every run.
Here is the json ouput :
"errors": [],
"generated_at": "2023-04-11T14:36:30Z",
"metrics": {
"_totals": {
"CONFIDENCE.HIGH": 47,
"CONFIDENCE.LOW": 7,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 47,
"SEVERITY.MEDIUM": 7,
"SEVERITY.UNDEFINED": 0,
"loc": 1010,
"nosec": 0,
"skipped_tests": 0
},
"some_file.py": {
"CONFIDENCE.HIGH": 3,
"CONFIDENCE.LOW": 0,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 3,
"SEVERITY.MEDIUM": 0,
"SEVERITY.UNDEFINED": 0,
"loc": 31,
"nosec": 0,
"skipped_tests": 0
}
},
"results": []
}kipped_tests": 0
}
},
"results": []
}s": []
}": 0
}
},
"results": []
}s": []
}"nosec": 0,
"skipped_tests": 0
}
},
"results": []
}
Here is my pre-commit hook :
- repo: https://github.com/PyCQA/bandit
rev: '1.7.4'
hooks:
- id: bandit
args: [-lll, -i, -f, json, -o, bandit_report.json]
Reproduction steps
1. Run the command : pre-commit run -a
2. Check the json file generated
Expected behavior
I would expect the json file to be properly formatted and not have this random excess at the end of the file.
Bandit version
1.7.4
Python version
3.11 (Default)
Additional context
Looks like the issue only happen when using bandit with pre-commit. I did the test using bandit alone an its working fine, so maybe this issue is not at the right place...
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working