@@ -16,6 +16,8 @@ import python
16
16
import semmle.python.dataflow.new.DataFlow
17
17
import semmle.python.dataflow.new.TaintTracking
18
18
import semmle.python.filters.Tests
19
+ private import semmle.python.dataflow.new.internal.DataFlowDispatch as DataFlowDispatch
20
+ private import semmle.python.dataflow.new.internal.Builtins:: Builtins as Builtins
19
21
20
22
bindingset [ char, fraction]
21
23
predicate fewer_characters_than ( StrConst str , string char , float fraction ) {
@@ -30,15 +32,13 @@ predicate fewer_characters_than(StrConst str, string char, float fraction) {
30
32
}
31
33
32
34
predicate possible_reflective_name ( string name ) {
33
- exists ( any ( ModuleValue m ) . attr ( name ) )
35
+ any ( Function f ) . getName ( ) = name
34
36
or
35
- exists ( any ( ClassValue c ) .lookup ( name ) )
37
+ any ( Class c ) .getName ( ) = name
36
38
or
37
- any ( ClassValue c ) .getName ( ) = name
39
+ any ( Module m ) .getName ( ) = name
38
40
or
39
- exists ( Module:: named ( name ) )
40
- or
41
- exists ( Value:: named ( name ) )
41
+ exists ( Builtins:: likelyBuiltin ( name ) )
42
42
}
43
43
44
44
int char_count ( StrConst str ) { result = count ( string c | c = str .getText ( ) .charAt ( _) ) }
@@ -84,7 +84,9 @@ class CredentialSink extends DataFlow::Node {
84
84
name .regexpMatch ( getACredentialRegex ( ) ) and
85
85
not name .matches ( "%file" )
86
86
|
87
- any ( FunctionValue func ) .getNamedArgumentForCall ( _, name ) = this .asCfgNode ( )
87
+ exists ( DataFlowDispatch:: ArgumentPosition pos | pos .isKeyword ( name ) |
88
+ this .( DataFlow:: ArgumentNode ) .argumentOf ( _, pos )
89
+ )
88
90
or
89
91
exists ( Keyword k | k .getArg ( ) = name and k .getValue ( ) .getAFlowNode ( ) = this .asCfgNode ( ) )
90
92
or
0 commit comments