Skip to content

Commit

Permalink
Remove openstack specific utils.exec checks
Browse files Browse the repository at this point in the history
Bandit is no longer OpenStack specific. As such, the utils.exec
from OpenStack Oslo should also be removed from Bandit

Signed-off-by: Eric Brown <browne@vmware.com>
  • Loading branch information
ericwb committed Jul 1, 2018
1 parent 02bad2e commit 652fd71
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 77 deletions.
8 changes: 3 additions & 5 deletions bandit/plugins/injection_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ def gen_config(name):
['subprocess.Popen',
'subprocess.call',
'subprocess.check_call',
'subprocess.check_output',
'utils.execute',
'utils.execute_with_timeout'],
'subprocess.check_output'],

# Start a process with a function vulnerable to shell injection.
'shell':
Expand Down Expand Up @@ -344,8 +342,8 @@ def any_other_function_with_shell_equals_true(context, config):
# Start a process using the subprocess module, or one of its
wrappers.
subprocess: [subprocess.Popen, subprocess.call,
subprocess.check_call, subprocess.check_output,
utils.execute, utils.execute_with_timeout]
subprocess.check_call, subprocess.check_output
execute_with_timeout]
:Example:
Expand Down
3 changes: 1 addition & 2 deletions doc/source/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ look like the following:
popen2.popen2, popen2.popen3, popen2.popen4, popen2.Popen3,
popen2.Popen4, commands.getoutput, commands.getstatusoutput]
subprocess: [subprocess.Popen, subprocess.call, subprocess.check_call,
subprocess.check_output,
utils.execute, utils.execute_with_timeout]
subprocess.check_output]
If you require several sets of tests for specific tasks, then you should create
several config files and pick from them using `-c`. If you only wish to control
Expand Down
26 changes: 0 additions & 26 deletions examples/exec-as-root.py

This file was deleted.

28 changes: 0 additions & 28 deletions examples/secret-config-option.py

This file was deleted.

8 changes: 0 additions & 8 deletions examples/utils-shell.py

This file was deleted.

8 changes: 0 additions & 8 deletions tests/functional/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,14 +422,6 @@ def test_urlopen(self):
}
self.check_example('urlopen.py', expect)

def test_utils_shell(self):
'''Test for `utils.execute*` with `shell=True`.'''
expect = {
'SEVERITY': {'UNDEFINED': 0, 'LOW': 5, 'MEDIUM': 0, 'HIGH': 0},
'CONFIDENCE': {'UNDEFINED': 0, 'LOW': 0, 'MEDIUM': 0, 'HIGH': 5}
}
self.check_example('utils-shell.py', expect)

def test_wildcard_injection(self):
'''Test for wildcard injection in shell commands.'''
expect = {
Expand Down

0 comments on commit 652fd71

Please sign in to comment.