
    >/i^                         S r SSKrSSKrSSKJr  SSKJr  S r\R                  \R                  " S5      \R                  " S5      S 5       5       5       rg)	a  
=========================================
B110: Test for a pass in the except block
=========================================

Errors in Python code bases are typically communicated using ``Exceptions``.
An exception object is 'raised' in the event of an error and can be 'caught' at
a later point in the program, typically some error handling or logging action
will then be performed.

However, it is possible to catch an exception and silently ignore it. This is
illustrated with the following example

.. code-block:: python

    try:
      do_some_stuff()
    except Exception:
      pass

This pattern is considered bad practice in general, but also represents a
potential security issue. A larger than normal volume of errors from a service
can indicate an attempt is being made to disrupt or interfere with it. Thus
errors should, at the very least, be logged.

There are rare situations where it is desirable to suppress errors, but this is
typically done with specific exception types, rather than the base Exception
class (or no type). To accommodate this, the test may be configured to ignore
'try, except, pass' where the exception is typed. For example, the following
would not generate a warning if the configuration option
``checked_typed_exception`` is set to False:

.. code-block:: python

    try:
      do_some_stuff()
    except ZeroDivisionError:
      pass

**Config Options:**

.. code-block:: yaml

    try_except_pass:
      check_typed_exception: True


:Example:

.. code-block:: none

    >> Issue: Try, Except, Pass detected.
       Severity: Low   Confidence: High
       CWE: CWE-703 (https://cwe.mitre.org/data/definitions/703.html)
       Location: ./examples/try_except_pass.py:4
    3        a = 1
    4    except:
    5        pass

.. seealso::

 - https://security.openstack.org
 - https://cwe.mitre.org/data/definitions/703.html

.. versionadded:: 0.13.0

.. versionchanged:: 1.7.3
    CWE information added

    N)issue)test_propertiesc                     U S:X  a  SS0$ g )Ntry_except_passcheck_typed_exceptionF )names    X/home/james-whalen/.local/lib/python3.13/site-packages/bandit/plugins/try_except_pass.py
gen_configr   R   s      '// !    ExceptHandlerB110c                    U R                   n[        UR                  5      S:X  a  US   (       d)  UR                  b  [	        UR                  SS 5      S:w  a  g [        UR                  S   [        R                  5      (       aK  [        R                  " [        R                  [        R                  [        R                  R                  SS9$ g g )N   r   id	Exceptionr   zTry, Except, Pass detected.)severity
confidencecwetext)nodelenbodytypegetattr
isinstanceastPassbanditIssueLOWHIGHr   CweIMPROPER_CHECK_OF_EXCEPT_COND)contextconfigr   s      r
   r   r   W   s     <<D
499~./		%		4.+=diilCHH--<<!;;II;;3	  . r   )__doc__r   r   bandit.corer   r   testr   takes_configcheckstest_idr   r   r   r
   <module>r-      s[   
EL    /0
 _f   r   