Skip to content

Commit a168af3

Browse files
committed
Python: Expand modeling of paramiko
1 parent a5a0861 commit a168af3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

python/ql/src/Security/CWE-295/MissingHostKeyValidation.ql

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,17 @@ import semmle.python.ApiGraphs
1616

1717
private API::Node unsafe_paramiko_policy(string name) {
1818
name in ["AutoAddPolicy", "WarningPolicy"] and
19-
result = API::moduleImport("paramiko").getMember("client").getMember(name)
19+
(
20+
result = API::moduleImport("paramiko").getMember("client").getMember(name)
21+
or
22+
result = API::moduleImport("paramiko").getMember(name)
23+
)
2024
}
2125

2226
private API::Node paramikoSshClientInstance() {
2327
result = API::moduleImport("paramiko").getMember("client").getMember("SSHClient").getReturn()
28+
or
29+
result = API::moduleImport("paramiko").getMember("SSHClient").getReturn()
2430
}
2531

2632
from DataFlow::CallCfgNode call, DataFlow::Node arg, string name

python/ql/test/query-tests/Security/CWE-295-MissingHostKeyValidation/MissingHostKeyValidation.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
| paramiko_host_key.py:7:1:7:49 | ControlFlowNode for Attribute() | Setting missing host key policy to WarningPolicy may be unsafe. |
33
| paramiko_host_key.py:11:1:11:51 | ControlFlowNode for Attribute() | Setting missing host key policy to AutoAddPolicy may be unsafe. |
44
| paramiko_host_key.py:13:1:13:51 | ControlFlowNode for Attribute() | Setting missing host key policy to WarningPolicy may be unsafe. |
5+
| paramiko_host_key.py:20:1:20:58 | ControlFlowNode for Attribute() | Setting missing host key policy to AutoAddPolicy may be unsafe. |

0 commit comments

Comments
 (0)