Skip to content

Commit 368f37a

Browse files
committed
Swift: And another.
1 parent 1f3ed1c commit 368f37a

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

swift/ql/src/queries/Security/CWE-089/SqlInjection.ql

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,15 @@ class CApiSqlSink extends SqlSink {
4747
class SQLiteSwiftSqlSink extends SqlSink {
4848
SQLiteSwiftSqlSink() {
4949
// Variants of `Connection.execute`, `connection.prepare` and `connection.scalar`.
50-
exists(ClassDecl c, AbstractFunctionDecl f, CallExpr call |
51-
c.getName() = "Connection" and
52-
c.getAMember() = f and
53-
f.getName() = ["execute(_:)", "prepare(_:_:)", "run(_:_:)", "scalar(_:_:)"] and
50+
exists(MethodDecl f, CallExpr call |
51+
f.hasQualifiedName("Connection", ["execute(_:)", "prepare(_:_:)", "run(_:_:)", "scalar(_:_:)"]) and
5452
call.getStaticTarget() = f and
5553
call.getArgument(0).getExpr() = this.asExpr()
5654
)
5755
or
5856
// String argument to the `Statement` constructor.
59-
exists(ClassDecl c, AbstractFunctionDecl f, CallExpr call |
60-
c.getName() = "Statement" and
61-
c.getAMember() = f and
62-
f.getName() = "init(_:_:)" and
57+
exists(MethodDecl f, CallExpr call |
58+
f.hasQualifiedName("Statement", "init(_:_:)") and
6359
call.getStaticTarget() = f and
6460
call.getArgument(1).getExpr() = this.asExpr()
6561
)

0 commit comments

Comments
 (0)