-
-
Notifications
You must be signed in to change notification settings - Fork 625
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle variant in how policy is passed in paramiko
Paramiko permits various ways of importing the missing host key policy. It allows paramiko.client.AutoAddPolicy or paramiko.AutoAddPolicy. The later isn't being handled in Bandit. This change adds news tests and modifies the plugin to inspect the AST to determine whether the argument is an Attribute, Name, or Call. Fixes #1077 Signed-off-by: Eric Brown <[email protected]>
- Loading branch information
Showing
2 changed files
with
13 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
from paramiko import client | ||
from paramiko import AutoAddPolicy | ||
from paramiko import WarningPolicy | ||
|
||
ssh_client = client.SSHClient() | ||
ssh_client.set_missing_host_key_policy(client.AutoAddPolicy) | ||
ssh_client.set_missing_host_key_policy(client.WarningPolicy) | ||
ssh_client.set_missing_host_key_policy(client.AutoAddPolicy()) | ||
ssh_client.set_missing_host_key_policy(client.WarningPolicy()) | ||
|
||
ssh_client.set_missing_host_key_policy(AutoAddPolicy) | ||
ssh_client.set_missing_host_key_policy(WarningPolicy) | ||
ssh_client.set_missing_host_key_policy(AutoAddPolicy()) | ||
ssh_client.set_missing_host_key_policy(WarningPolicy()) |