You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Gets the regular expression used for matching strings that look like they
64
+
* contain an interesting word.
65
+
*/
66
+
private string getInterestingWordRegex() {
67
+
result = "(^|\\w+(?=[A-Z]))((?i)" + concat(getAnInterestingWord(), "|") + ")($|(?![a-z])\\w+)"
68
+
}
69
+
70
+
/** Gets a word that is uninteresting because it likely does not indicate a state change. */
71
+
private string getAnUninterestingWord() {
72
+
result = ["get", "show", "view", "list", "query", "find"]
73
+
}
74
+
75
+
/**
76
+
* Gets the regular expression used for matching strings that look like they
77
+
* contain an uninteresting word.
78
+
*/
79
+
private string getUninterestingWordRegex() {
80
+
result = "^(" + concat(getAnUninterestingWord(), "|") + ")(?![a-z])\\w*"
81
+
}
82
+
52
83
/** A method that appears to change application state based on its name. */
53
-
private class NameStateChangeMethod extends Method {
54
-
NameStateChangeMethod() {
55
-
this.getName()
56
-
.regexpMatch("(^|\\w+(?=[A-Z]))((?i)post|put|patch|delete|remove|create|add|update|edit|(un|)publish|fill|move|transfer|log(out|in)|access|connect(|ion)|register|submit)($|(?![a-z])\\w+)") and
57
-
not this.getName().regexpMatch("^(get|show|view|list|query|find)(?![a-z])\\w*")
84
+
private class NameBasedStateChangeMethod extends Method {
85
+
NameBasedStateChangeMethod() {
86
+
this.getName().regexpMatch(getInterestingWordRegex()) and
87
+
not this.getName().regexpMatch(getUninterestingWordRegex())
58
88
}
59
89
}
60
90
@@ -91,9 +121,9 @@ private class PreparedStatementDatabaseUpdateMethod extends DatabaseUpdateMethod
91
121
}
92
122
}
93
123
94
-
/** A method found via the sql-injection models which may update a SQL database. */
95
-
private class SqlInjectionMethod extends DatabaseUpdateMethod {
96
-
SqlInjectionMethod() {
124
+
/** A method found via the sql-injection sink models which may update a database. */
125
+
private class SqlInjectionDatabaseUpdateMethod extends DatabaseUpdateMethod {
126
+
SqlInjectionDatabaseUpdateMethod() {
97
127
exists(DataFlow::Node n | this = n.asExpr().(Argument).getCall().getCallee() |
98
128
sinkNode(n, "sql-injection") and
99
129
// do not include `executeQuery` since it is typically used with a select statement
@@ -106,9 +136,10 @@ private class SqlInjectionMethod extends DatabaseUpdateMethod {
106
136
}
107
137
108
138
/**
109
-
* A taint-tracking configuration for reasoning about SQL queries that update a database.
139
+
* A taint-tracking configuration for reasoning about SQL statements that update
0 commit comments