bandit/examples/imports-function.py
Tim Kelsey 8ba353603f Fix a reported bug when bandit encounters "__import__()"
Parsing "__import__()" results in an exception from the test
blacklist_import_func, since it assumes the the call will have a
parameter. Calling __import__ without a parameter is not valid
python, however this bug has been seen in the wild.

Change-Id: Ia9476f19fa0b571c71a7410152e95757543ec5ea
Closes-bug: 1396333
2014-11-26 16:22:05 +00:00

9 lines
250 B
Python

os = __import__("os")
pickle = __import__("pickle")
sys = __import__("sys")
subprocess = __import__("subprocess")
# this has been reported in the wild, though it's invalid python
# see bug https://bugs.launchpad.net/bandit/+bug/1396333
__import__()