
    >/id	                         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)a  
===============================
B506: Test for use of yaml load
===============================

This plugin test checks for the unsafe usage of the ``yaml.load`` function from
the PyYAML package. The yaml.load function provides the ability to construct
an arbitrary Python object, which may be dangerous if you receive a YAML
document from an untrusted source. The function yaml.safe_load limits this
ability to simple Python objects like integers or lists.

Please see
https://pyyaml.org/wiki/PyYAMLDocumentation#LoadingYAML for more information
on ``yaml.load`` and yaml.safe_load

:Example:

.. code-block:: none

    >> Issue: [yaml_load] Use of unsafe yaml load. Allows instantiation of
       arbitrary objects. Consider yaml.safe_load().
       Severity: Medium   Confidence: High
       CWE: CWE-20 (https://cwe.mitre.org/data/definitions/20.html)
       Location: examples/yaml_load.py:5
    4 ystr = yaml.dump({'a' : 1, 'b' : 2, 'c' : 3})
    5 y = yaml.load(ystr)
    6 yaml.dump(y)

.. seealso::

 - https://pyyaml.org/wiki/PyYAMLDocumentation#LoadingYAML
 - https://cwe.mitre.org/data/definitions/20.html

.. versionadded:: 1.0.0

.. versionchanged:: 1.7.3
    CWE information added

    N)issue)test_propertiesB506Callc           
      <   U R                  S5      nU R                  nU(       d  [        U[        5      (       a  g UR	                  S5      nUS   n[        SU;   US:H  U R                  SS5      (       + U R                  SS5      (       + U R                  S5      S:X  + U R                  S5      S:X  + /5      (       a`  [        R                  " [        R                  [        R                  [        R                  R                  S	U R                  R                   S
9$ g )Nyaml.loadLoader
SafeLoaderCSafeLoader   z^Use of unsafe yaml load. Allows instantiation of arbitrary objects. Consider yaml.safe_load().)severity
confidencecwetextlineno)is_module_imported_exactcall_function_name_qual
isinstancestrsplitallcheck_call_arg_valueget_call_arg_at_positionbanditIssueMEDIUMHIGHr   CweIMPROPER_INPUT_VALIDATIONnoder   )contextimportedqualnamequalname_listfuncs        R/home/james-whalen/.local/lib/python3.13/site-packages/bandit/plugins/yaml_load.py	yaml_loadr*   1   s     //7H..H
8S11NN3'MD
m#FN,,X|DD,,X}EE003|C003}D	
	 	 ||]]{{		33=<<&&
 	
	    )	__doc__r   bandit.corer   r   testtest_idchecksr*    r+   r)   <module>r2      sD   
&N   / fV
  
r+   