bandit1.7.0

S102 Test for the use of exec

This plugin test checks for the use of Python's exec method or keyword. The Python docs succinctly describe why the use of exec is risky.

  • Example
>> Issue: Use of exec detected.
   Severity: Medium   Confidence: High
   Location: ./examples/exec-py2.py:2
1 exec("do evil")
2 exec "do evil"

See Also:

- https://docs.python.org/2/reference/simple_stmts.html#exec
- https://docs.python.org/3/library/functions.html#exec
- https://www.python.org/dev/peps/pep-0551/#background
- https://www.python.org/dev/peps/pep-0578/#suggested-audit-hook-locations
0.9.0