
    >/i                         S r SSKrSSKJr  SSKJr  \R                  " S5      \R                  " S5      S 5       5       rg)a3  
======================================================
B201: Test for use of flask app with debug set to true
======================================================

Running Flask applications in debug mode results in the Werkzeug debugger
being enabled. This includes a feature that allows arbitrary code execution.
Documentation for both Flask [1]_ and Werkzeug [2]_ strongly suggests that
debug mode should never be enabled on production systems.

Operating a production server with debug mode enabled was the probable cause
of the Patreon breach in 2015 [3]_.

:Example:

.. code-block:: none

    >> Issue: A Flask app appears to be run with debug=True, which exposes
    the Werkzeug debugger and allows the execution of arbitrary code.
       Severity: High   Confidence: High
       CWE: CWE-94 (https://cwe.mitre.org/data/definitions/94.html)
       Location: examples/flask_debug.py:10
    9 #bad
    10    app.run(debug=True)
    11

.. seealso::

 .. [1] https://flask.palletsprojects.com/en/1.1.x/quickstart/#debug-mode
 .. [2] https://werkzeug.palletsprojects.com/en/1.0.x/debug/
 .. [3] https://labs.detectify.com/2015/10/02/how-patreon-got-hacked-publicly-exposed-werkzeug-debugger/
 .. https://cwe.mitre.org/data/definitions/94.html

.. versionadded:: 0.15.0

.. versionchanged:: 1.7.3
    CWE information added

    N)issue)test_propertiesB201Callc           	      X   U R                  S5      (       a  U R                  R                  S5      (       as  U R                  SS5      (       a[  [        R
                  " [        R                  [        R                  [        R                  R                  SU R                  S5      S9$ g g g )Nflaskz.rundebugTruez~A Flask app appears to be run with debug=True, which exposes the Werkzeug debugger and allows the execution of arbitrary code.)severity
confidencecwetextlineno)is_module_imported_likecall_function_name_qualendswithcheck_call_arg_valuebanditIssueHIGHMEDIUMr   CweCODE_INJECTIONget_lineno_for_call_arg)contexts    R/home/james-whalen/.local/lib/python3.13/site-packages/bandit/plugins/app_debug.pyflask_debug_truer   1   s     &&w//**33F;;++GV<<||#[[%}}		007 #::7C  = < 0    )	__doc__r   bandit.corer   r   testtest_idchecksr    r   r   <module>r%      sD   
&N   / fV  r   