A Flask application is run in debug mode
What it finds
app.run(debug=True): Flask's debug mode shows tracebacks with the program's source and offers a console in the browser that runs any Python code typed into it. On a server others can reach, that hands them the machine (CWE-489).
The receiver must be a variable bound once to flask.Flask(...).
From the rule's source, flask_debug.rs.
from flask import Flask app = Flask(__name__)other = make_app() if __name__ == "__main__": app.run(debug=True)tx0 reports: this Flask application runs in debug mode app.run(debug=False) app.run() other.run(debug=True) Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/python:flask-debug" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
# tx0: ignore[tx0/python:flask-debug] reason="..."tx0 explain tx0/python:flask-debug shows the same in the terminal. Found a false positive? Report it.