deb-bandit/examples/eval.py
David Wyde f0655ee323 Update the config file, and use yaml.safe_load()
- Parse the config file with yaml.safe_load(), not yaml.load().
- Use YAML lists for the blacklist functions/imports plugins.
- Add plugins to the ShellInjection profile in the config.
- Don't blacklist user-defined methods named `eval`.

Change-Id: I437eedc4bfd56c96116cb92fe555968cf0f8dd63
2015-03-12 17:11:46 -05:00

16 lines
283 B
Python

import os
print(eval("1+1"))
print(eval("os.getcwd()"))
print(eval("os.chmod('%s', 0777)" % 'test.txt'))
# A user-defined method named "eval" should not get flagged.
class Test(object):
def eval(self):
print("hi")
def foo(self):
self.eval()
Test().eval()