@@ -7,10 +7,14 @@ abstract class StringKind extends TaintKind {
7
7
bindingset [ this ]
8
8
StringKind ( ) { this = this }
9
9
10
+ override TaintKind getTaintOfMethodResult ( string name ) {
11
+ name in [ "strip" , "format" , "lstrip" , "rstrip" , "ljust" , "rjust" , "title" , "capitalize" ] and
12
+ result = this
13
+ }
14
+
10
15
override TaintKind getTaintForFlowStep ( ControlFlowNode fromnode , ControlFlowNode tonode ) {
11
16
result = this and
12
17
(
13
- str_method_call ( fromnode , tonode ) or
14
18
slice ( fromnode , tonode ) or
15
19
tonode .( BinaryExprNode ) .getAnOperand ( ) = fromnode or
16
20
os_path_join ( fromnode , tonode ) or
@@ -50,20 +54,6 @@ private class StringEqualitySanitizer extends Sanitizer {
50
54
}
51
55
}
52
56
53
- /* tonode = fromnode.xxx() where the call to xxx returns an identical or similar string */
54
- private predicate str_method_call ( ControlFlowNode fromnode , CallNode tonode ) {
55
- exists ( string method_name | tonode .getFunction ( ) .( AttrNode ) .getObject ( method_name ) = fromnode |
56
- method_name = "strip" or
57
- method_name = "format" or
58
- method_name = "lstrip" or
59
- method_name = "rstrip" or
60
- method_name = "ljust" or
61
- method_name = "rjust" or
62
- method_name = "title" or
63
- method_name = "capitalize"
64
- )
65
- }
66
-
67
57
/* tonode = ....format(fromnode) */
68
58
private predicate str_format ( ControlFlowNode fromnode , CallNode tonode ) {
69
59
tonode .getFunction ( ) .( AttrNode ) .getName ( ) = "format" and
0 commit comments