f-strings marked with a # nosec BXXX
show an incorrect warning about no failed tests appears
#1204
Labels
bug
Something isn't working
Describe the bug
When running bandit against code using f-strings that are marked with
# nosec BXXX
a warning appears when there should not be one. This happens for both single-line and multi-line f-strings. The behaviour is not present when using blanketnosec
or when using template strings.Works:
Incorrect Warning:
[tester] WARNING nosec encountered (B608), but no failed test on line 3
[tester] WARNING nosec encountered (B608), but no failed test on line 2
Reproduction steps
Expected behavior
No warning appears when the a
nosec
correctly applies to a failed test.Bandit version
1.7.10 (Default)
Python version
3.12
Additional context
This seems related to #942, #1003, #1041 and #1092
While playing around I applied the patch from #1004 but that did not resolve this issue.
The text was updated successfully, but these errors were encountered: