Files
deb-bandit/examples/flask_debug.py
Jamie Finnigan 517ab2f7ab Add check for Flask app debug=True usage
When executed with debug=True, Flask applications expose the Werkzeug
debugger which includes an abritrary code execution function.

This check looks for a combination of the flask module being imported,
a .run() call, and a named argument debug=True.

Setting it up in plugins/app_debug.py so we can add checks for Django
and perhaps other frameworks in future.

Change-Id: If49e53d0807dfc2fccad6433edc5ef43f5464f22
Implements: blueprint detect-werkzeug-debug-enabled
2015-10-13 13:56:35 -04:00

20 lines
195 B
Python

from flask import Flask
app = Flask(__name__)
@app.route('/')
def main():
raise
#bad
app.run(debug=True)
#okay
app.run()
app.run(debug=False)
#unrelated
run()
run(debug=True)
run(debug)