Skip to content

Commit 02dc9be

Browse files
committed
Swift: Fix the versions in 'examples' as well.
1 parent 2999b5f commit 02dc9be

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

swift/ql/examples/snippets/simple_constant_password.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ module ConstantPasswordFlow = TaintTracking::Global<ConstantPasswordConfig>;
2323

2424
from DataFlow::Node sourceNode, DataFlow::Node sinkNode
2525
where ConstantPasswordFlow::flow(sourceNode, sinkNode)
26-
select sinkNode, "The value '" + sourceNode.toString() + "' is used as a constant password."
26+
select sinkNode, "The value $@ is used as a constant password.", sourceNode, sourceNode.toString()

swift/ql/examples/snippets/simple_sql_injection.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module SqlInjectionConfig implements DataFlow::ConfigSig {
1717

1818
predicate isSink(DataFlow::Node node) {
1919
exists(CallExpr call |
20-
call.getStaticTarget().(MethodDecl).hasQualifiedName("Connection", "execute(_:)") and
20+
call.getStaticTarget().(Method).hasQualifiedName("Connection", "execute(_:)") and
2121
call.getArgument(0).getExpr() = node.asExpr()
2222
)
2323
}

swift/ql/examples/snippets/simple_uncontrolled_string_format.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
import swift
1010
import codeql.swift.dataflow.DataFlow
1111

12-
from CallExpr call, MethodDecl method, Expr sinkExpr
12+
from CallExpr call, Method method, DataFlow::Node sinkNode
1313
where
1414
call.getStaticTarget() = method and
1515
method.hasQualifiedName("String", "init(format:_:)") and
16-
sinkExpr = call.getArgument(0).getExpr() and
16+
sinkNode.asExpr() = call.getArgument(0).getExpr() and
1717
not exists(StringLiteralExpr sourceLiteral |
18-
DataFlow::localFlow(DataFlow::exprNode(sourceLiteral), DataFlow::exprNode(sinkExpr))
18+
DataFlow::localFlow(DataFlow::exprNode(sourceLiteral), sinkNode)
1919
)
2020
select call, "Format argument to " + method.getName() + " isn't hard-coded."

0 commit comments

Comments
 (0)