Skip to content

Commit

Permalink
Remove redundant Python 3.6 code (#802)
Browse files Browse the repository at this point in the history
Bandit no longer supports Pytyon 3.6 and earlier since those are
end-of-life. Therefore there is no longer a need to have any
code that conditional checks on versions as early as that.

This change cleans up the sql_statements check to only be for
Python 3.7 and later.

Closes #800

Signed-off-by: Eric Brown <browne@vmware.com>
  • Loading branch information
ericwb committed Feb 7, 2022
1 parent 6b6b896 commit 9131162
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 76 deletions.
41 changes: 0 additions & 41 deletions examples/sql_statements-py36.py

This file was deleted.

50 changes: 15 additions & 35 deletions tests/functional/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,41 +385,21 @@ def test_ignore_skip(self):

def test_sql_statements(self):
"""Test for SQL injection through string building."""
filename = "sql_statements{}.py"
if sys.version_info <= (3, 6):
filename = filename.format("")
expect = {
"SEVERITY": {
"UNDEFINED": 0,
"LOW": 0,
"MEDIUM": 14,
"HIGH": 0,
},
"CONFIDENCE": {
"UNDEFINED": 0,
"LOW": 8,
"MEDIUM": 6,
"HIGH": 0,
},
}
else:
filename = filename.format("-py36")
expect = {
"SEVERITY": {
"UNDEFINED": 0,
"LOW": 0,
"MEDIUM": 16,
"HIGH": 0,
},
"CONFIDENCE": {
"UNDEFINED": 0,
"LOW": 9,
"MEDIUM": 7,
"HIGH": 0,
},
}

self.check_example(filename, expect)
expect = {
"SEVERITY": {
"UNDEFINED": 0,
"LOW": 0,
"MEDIUM": 14,
"HIGH": 0,
},
"CONFIDENCE": {
"UNDEFINED": 0,
"LOW": 8,
"MEDIUM": 6,
"HIGH": 0,
},
}
self.check_example("sql_statements.py", expect)

def test_ssl_insecure_version(self):
"""Test for insecure SSL protocol versions."""
Expand Down

0 comments on commit 9131162

Please sign in to comment.