A paramiko SSH client accepts servers whose host key it does not know
What it finds
AutoAddPolicy and WarningPolicy let the client connect to a server it has never seen and trust whatever key it presents, so anyone between client and server can pose as the server and read the session. Known keys belong in a known_hosts file loaded with load_system_host_keys or load_host_keys, and RejectPolicy refuses the rest.
From the rule's source, ssh_unknown_host_accepted.rs.
import paramiko client = paramiko.SSHClient()client.set_missing_host_key_policy(paramiko.AutoAddPolicy())tx0 reports: AutoAddPolicy trusts the key of any serverclient.set_missing_host_key_policy(paramiko.WarningPolicy)tx0 reports: WarningPolicy trusts the keyclient.set_missing_host_key_policy(paramiko.RejectPolicy()) 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:ssh-unknown-host-accepted" = "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:ssh-unknown-host-accepted] reason="..."tx0 explain tx0/python:ssh-unknown-host-accepted shows the same in the terminal. Found a false positive? Report it.