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 1010 */
1111
1212import python
13+ import semmle.python.dataflow.new.DataFlow
1314import semmle.python.ApiGraphs
1415
1516private API:: Node unsafe_paramiko_policy ( string name ) {
@@ -21,12 +22,12 @@ private API::Node paramikoSSHClientInstance() {
2122 result = API:: moduleImport ( "paramiko" ) .getMember ( "client" ) .getMember ( "SSHClient" ) .getReturn ( )
2223}
2324
24- from CallNode call , ControlFlowNode arg , string name
25+ from DataFlow :: CallCfgNode call , DataFlow :: Node arg , string name
2526where
26- call = paramikoSSHClientInstance ( ) .getMember ( "set_missing_host_key_policy" ) .getACall ( ) . asCfgNode ( ) and
27+ call = paramikoSSHClientInstance ( ) .getMember ( "set_missing_host_key_policy" ) .getACall ( ) and
2728 arg = call .getAnArg ( ) and
2829 (
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 ( )
3132 )
3233select 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 {
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+ }
196203}
197204
198205/**
You can’t perform that action at this time.
0 commit comments