@@ -71,11 +71,7 @@ private predicate str_method_call(ControlFlowNode fromnode, CallNode tonode) {
7171/* tonode = ....format(fromnode) */
7272private predicate str_format ( ControlFlowNode fromnode , CallNode tonode ) {
7373 tonode .getFunction ( ) .( AttrNode ) .getName ( ) = "format" and
74- (
75- tonode .getAnArg ( ) = fromnode
76- or
77- tonode .getNode ( ) .getAKeyword ( ) .getValue ( ) = fromnode .getNode ( )
78- )
74+ tonode .getAnArg ( ) = fromnode
7975}
8076
8177/* tonode = codec.[en|de]code(fromnode)*/
@@ -93,9 +89,10 @@ private predicate encode_decode(ControlFlowNode fromnode, CallNode tonode) {
9389/* tonode = str(fromnode)*/
9490private predicate to_str ( ControlFlowNode fromnode , CallNode tonode ) {
9591 tonode .getAnArg ( ) = fromnode and
96- exists ( ClassObject str |
97- tonode .getFunction ( ) .refersTo ( str ) |
98- str = theUnicodeType ( ) or str = theBytesType ( )
92+ (
93+ tonode = ClassValue:: bytes ( ) .getACall ( )
94+ or
95+ tonode = ClassValue:: unicode ( ) .getACall ( )
9996 )
10097}
10198
@@ -110,11 +107,8 @@ private predicate slice(ControlFlowNode fromnode, SubscriptNode tonode) {
110107
111108/* tonode = os.path.join(..., fromnode, ...) */
112109private predicate os_path_join ( ControlFlowNode fromnode , CallNode tonode ) {
113- exists ( FunctionObject path_join |
114- path_join = ModuleObject:: named ( "os" ) .attr ( "path" ) .( ModuleObject ) .attr ( "join" )
115- and
116- tonode = path_join .getACall ( ) and tonode .getAnArg ( ) = fromnode
117- )
110+ tonode = Value:: named ( "os.path.join" ) .getACall ( )
111+ and tonode .getAnArg ( ) = fromnode
118112}
119113
120114/** A kind of "taint", representing a dictionary mapping str->"taint" */
@@ -125,5 +119,3 @@ class StringDictKind extends DictKind {
125119 }
126120
127121}
128-
129-
0 commit comments