File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
swift/ql/lib/codeql/swift/security Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -147,15 +147,23 @@ private class GrdbDefaultSqlInjectionSink extends SqlInjectionSink {
147
147
}
148
148
}
149
149
150
+ /**
151
+ * A parameter that might be executed as SQL.
152
+ */
153
+ pragma [ noinline] predicate sqlLikeHeuristic ( Callable f , int ix , ParamDecl pd ) {
154
+ pd .getName ( ) = "sql" and
155
+ pd = f .getParam ( ix )
156
+ }
157
+
150
158
/**
151
159
* An SQL injection sink that is determined by imprecise methods.
152
160
*/
153
161
private class HeuristicSqlInjectionSink extends SqlInjectionSink {
154
162
HeuristicSqlInjectionSink ( ) {
155
163
// by parameter name
156
- exists ( CallExpr ce , int ix , ParamDecl pd |
157
- pd . getName ( ) = "sql" and
158
- pd = ce .getStaticTarget ( ) . getParam ( ix ) and
164
+ exists ( CallExpr ce , Callable f , int ix |
165
+ sqlLikeHeuristic ( f , ix , _ ) and
166
+ f = ce .getStaticTarget ( ) and
159
167
this .asExpr ( ) = ce .getArgument ( ix ) .getExpr ( )
160
168
)
161
169
or
You can’t perform that action at this time.
0 commit comments