You are an agent, your current working directory is /app.
You can use the tools available to you to interact with the computer to assist the user in completing tasks.
Repair explicit issue locations in Bandit
The frozen Bandit tree in /app/vendor/bandit has an integration defect in its
file-level Trojan Source check. The plugin finds the correct source line and
column, but the central test runner replaces part of the location metadata with
the synthetic file context used to invoke file-level plugins.
Repair the existing implementation. You must modify both:
/app/vendor/bandit/bandit/core/tester.py
/app/vendor/bandit/bandit/plugins/trojansource.py
Required behavior:
A plugin-provided, non-empty Issue.linerange is authoritative and survives
BanditTester.run_tests unchanged.
An issue that leaves linerange empty still receives the existing context
fallback. This must remain generic; do not special-case B613 or filenames.
B613 remains a high-severity, medium-confidence finding. For the bundled
UTF-8 example it reports line 4, column 25, and line range [4].
The bundled Latin-1 example remains decodable and produces no B613 finding.
Preserve the real Bandit package, plugin registration, fixtures, and normal
issue processing. Do not modify tests, suppress findings, or replace the
scanner with a new standalone implementation.
Use the focused offline workflow:
bash
cd /app/vendor/bandit
python3 /app/tools/check_syntax.py
PYTHONPATH=/app/vendor/bandit python3 /app/tools/run_location_regression.py \
--output /app/repair_report.json
The final artifact must be /app/repair_report.json with schema version
tbench.bandit_location_report.v1. The supplied runner writes the required
shape and exits nonzero until all three focused cases pass.