[security] Make bandit scanner compatible with local build and submodule folders #8838
All Vouch review confidence checks passed
Residual risk 0.26 = Change Risk (0.65) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.65 · 327 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.347
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.065
Real PR Conversation Timeline
1 comments
"Review active on #8838"
general
weight: 0.35
geomin12
Motivation
Progress on https://github.com/ROCm/TheRock/issues/8272
This allows developers to run the bandit (https://bandit.readthedocs.io/en/latest/) scanner for python security issues locally. I'm separately looking through the remaining issues it reports and figuring out how to address them.
Technical Details
I decided to drop
testfromexclude_dirs(as that may also matchtest_tools/) and switched to more tightly-scopedassert_used: skips:rules. This revealed a few high severity issues in tests which are fixed here too.The extra
bandit.inifile is needed when running locally to prevent bandit from auto-discovering ambiguousbandit.inifiles in submodules and build outputs (great design...). This isn't mentioned anywhere on https://bandit.readthedocs.io/en/latest/config.html though :/. Specifically this file https://github.com/ROCm/libhipcxx/blob/amd-develop/.bandit appears in multiple directories and running without--iniresults in:Test Plan
From a source checkout with build directories, virtual environments, submodules initialized, etc.:
Submission Checklist