Skip to content

Commit bf66bdb

Browse files
authored
Merge pull request github#5253 from RasmusWL/no-getAnArg
Approved by tausbn
2 parents a05904f + d05a8b8 commit bf66bdb

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ private API::Node paramikoSSHClientInstance() {
2424

2525
from DataFlow::CallCfgNode call, DataFlow::Node arg, string name
2626
where
27+
// see http://docs.paramiko.org/en/stable/api/client.html#paramiko.client.SSHClient.set_missing_host_key_policy
2728
call = paramikoSSHClientInstance().getMember("set_missing_host_key_policy").getACall() and
28-
arg = call.getAnArg() and
29+
arg in [call.getArg(0), call.getArgByName("policy")] and
2930
(
3031
arg = unsafe_paramiko_policy(name).getAUse() or
3132
arg = unsafe_paramiko_policy(name).getReturn().getAUse()

python/ql/src/semmle/python/dataflow/new/internal/DataFlowPublic.qll

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,6 @@ class CallCfgNode extends CfgNode {
193193

194194
/** Gets the data-flow node corresponding to the named argument of the call corresponding to this data-flow node */
195195
Node getArgByName(string name) { result.asCfgNode() = node.getArgByName(name) }
196-
197-
/** Gets the data-flow node corresponding to an argument of the call corresponding to this data-flow node */
198-
Node getAnArg() {
199-
exists(int n | result = this.getArg(n))
200-
or
201-
exists(string name | result = this.getArgByName(name))
202-
}
203196
}
204197

205198
/**

0 commit comments

Comments
 (0)