Skip to content
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

Bandit Baseline with severity filtering is broken #40

Closed
ericwb opened this issue Apr 26, 2018 · 1 comment
Closed

Bandit Baseline with severity filtering is broken #40

ericwb opened this issue Apr 26, 2018 · 1 comment

Comments

@ericwb
Copy link
Member

ericwb commented Apr 26, 2018

If the baseline feature is used along with severity filtering the results end up broken.

Basically, the current baseline routine is to check if there are different results in the currently checked file than what is present in the baseline. If so, all the issues from the current file are inputted and then filtered. To make this clear let's say we have original file a.py:

import subprocess
do_something_benign()
os.system('/tmp/something_bad')

We'll get a low severity finding for subprocess usage, but if we examine this file with a -ll filter, this will be suppressed from the baseline output. We also get a higher severity error which for /tmp.

Now we run a baseline comparison against it, the first action that is performed is checking the results against the previous level. Since the previous level had the LOW severity finding filtered out, it only has the MEDIUM. Since no filtering has been done yet, the current version of the file includes the low severity issue. Basically the baseline has the low severity issue filtered out and the current version doesn't. So they don't match and all of the issues from the file get added to the results.

At this point filtering is done so the LOW severity issue is removed, but the point is even though nothing changed in this file Bandit thinks it did.

The correct behavior is to filter severity first.

@ericwb
Copy link
Member Author

ericwb commented Apr 27, 2018

Launchpad bug to Github issue import error

@ericwb ericwb closed this as completed Apr 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant