File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
semmle/python/dataflow/new/internal Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 10
10
*/
11
11
12
12
import python
13
+ import semmle.python.dataflow.new.DataFlow
13
14
import semmle.python.ApiGraphs
14
15
15
16
private API:: Node unsafe_paramiko_policy ( string name ) {
@@ -21,12 +22,12 @@ private API::Node paramikoSSHClientInstance() {
21
22
result = API:: moduleImport ( "paramiko" ) .getMember ( "client" ) .getMember ( "SSHClient" ) .getReturn ( )
22
23
}
23
24
24
- from CallNode call , ControlFlowNode arg , string name
25
+ from DataFlow :: CallCfgNode call , DataFlow :: Node arg , string name
25
26
where
26
- call = paramikoSSHClientInstance ( ) .getMember ( "set_missing_host_key_policy" ) .getACall ( ) . asCfgNode ( ) and
27
+ call = paramikoSSHClientInstance ( ) .getMember ( "set_missing_host_key_policy" ) .getACall ( ) and
27
28
arg = call .getAnArg ( ) and
28
29
(
29
- arg = unsafe_paramiko_policy ( name ) .getAUse ( ) . asCfgNode ( ) or
30
- arg = unsafe_paramiko_policy ( name ) .getReturn ( ) .getAUse ( ) . asCfgNode ( )
30
+ arg = unsafe_paramiko_policy ( name ) .getAUse ( ) or
31
+ arg = unsafe_paramiko_policy ( name ) .getReturn ( ) .getAUse ( )
31
32
)
32
33
select call , "Setting missing host key policy to " + name + " may be unsafe."
Original file line number Diff line number Diff line change @@ -193,6 +193,13 @@ class CallCfgNode extends CfgNode {
193
193
194
194
/** Gets the data-flow node corresponding to the named argument of the call corresponding to this data-flow node */
195
195
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
+ }
196
203
}
197
204
198
205
/**
You can’t perform that action at this time.
0 commit comments