-
-
Notifications
You must be signed in to change notification settings - Fork 616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Erroneous "no test failure on line" warning from plugin alert nosec? #942
Comments
I'm facing the same issue using Bandit 1.7.4 with Python 3.10.4. Here's another minimal example for repro: import os
cmd = "df -h"
os.popen(cmd).read() # nosec B605
full log
However, the problem does not occur if I remove |
I'm still seeing the same thing with Bandit 1.7.5 on Python 3.11.4. Yet another minimal example: import os
import subprocess # nosec B404
subprocess.run([os.getenv("SHELL")], check=False) # nosec B603 Bandit says:
but if I remove the
|
The problem appears to be related to how bandit observes "lines" where multiple function calls occur on the same line? I get the warning if I do
or
But I do not get the warning if I do
|
Describe the bug
It looks like bandit warns about "no test failure on line" for a nosec where there definitely would be a test failure without the nosec.
Reproduction steps
foo = hashlib.md5(buffer.read()).digest()
.bandit -ll
rightly complains about the use of MD5 with a B324 error from the hashlib plugin.#nosec B324
like this:foo = hashlib.md5(buffer.read()).digest() # nosec B324
[tester] WARNING nosec encountered (B324), but no failed test on line 85
Seems a bit weird.
Expected behavior
Don't warn at me for this.
Bandit version
1.7.4 (Default)
Python version
3.9
Additional context
No response
The text was updated successfully, but these errors were encountered: