
    >/i
                         S r SSK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  
==========================================
B507: Test for missing host key validation
==========================================

Encryption in general is typically critical to the security of many
applications.  Using SSH can greatly increase security by guaranteeing the
identity of the party you are communicating with.  This is accomplished by one
or both parties presenting trusted host keys during the connection
initialization phase of SSH.

When paramiko methods are used, host keys are verified by default. If host key
verification is disabled, Bandit will return a HIGH severity error.

:Example:

.. code-block:: none

    >> Issue: [B507:ssh_no_host_key_verification] Paramiko call with policy set
    to automatically trust the unknown host key.
    Severity: High   Confidence: Medium
    CWE: CWE-295 (https://cwe.mitre.org/data/definitions/295.html)
    Location: examples/no_host_key_verification.py:4
    3   ssh_client = client.SSHClient()
    4   ssh_client.set_missing_host_key_policy(client.AutoAddPolicy)
    5   ssh_client.set_missing_host_key_policy(client.WarningPolicy)


.. versionadded:: 1.5.1

.. versionchanged:: 1.7.3
    CWE information added

    N)issue)test_propertiesCallB507c           	      v   U R                  S5      (       Ga  U R                  S:X  Ga  U R                  R                  (       Gas  U R                  R                  S   nS n[	        U[
        R                  5      (       a  UR                  nO[	        U[
        R                  5      (       a  UR                  nO[	        U[
        R                  5      (       a  [	        UR                  [
        R                  5      (       a  UR                  R                  nO?[	        UR                  [
        R                  5      (       a  UR                  R                  nUS;   a[  [        R                  " [        R                  [        R                  [         R"                  R$                  SU R'                  S5      S9$ g g g g )Nparamikoset_missing_host_key_policyr   )AutoAddPolicyWarningPolicyzJParamiko call with policy set to automatically trust the unknown host key.)severity
confidencecwetextlineno)is_module_imported_likecall_function_namenodeargs
isinstanceast	AttributeattrNameidr   funcbanditIssueHIGHMEDIUMr   CweIMPROPER_CERT_VALIDATIONget_lineno_for_call_arg)contextpolicy_argumentpolicy_argument_values      e/home/james-whalen/.local/lib/python3.13/site-packages/bandit/plugins/ssh_no_host_key_verification.pyssh_no_host_key_verificationr'   -   sL    	''
33&&*GGLL!,,++A. $os}}55$3$8$8!22$3$6$6!22/..>>(7(<(<(A(A%O00#((;;(7(<(<(?(?% $FF<<!==II66(661	 	 G  H 	4    )
__doc__r   r   bandit.corer   r   testcheckstest_idr'    r(   r&   <module>r/      sG   !D    / Vf  r(   