Skip to content

Commit 2fd8b87

Browse files
geoffw0MathiasVP
andauthored
Apply suggestions from code review
Co-authored-by: Mathias Vorreiter Pedersen <[email protected]>
1 parent 837f16c commit 2fd8b87

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/codeql/codeql-language-guides/analyzing-data-flow-in-swift.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ The ``Node`` class has a number of useful subclasses, such as ``ExprNode`` for e
2929
/**
3030
* Gets this node's underlying expression, if any.
3131
*/
32-
Expr asExpr() { none() }
32+
Expr asExpr() { ... }
3333
3434
/**
3535
* Gets this data flow node's corresponding control flow node.
3636
*/
37-
ControlFlowNode getCfgNode() { none() }
37+
ControlFlowNode getCfgNode() { ... }
3838
3939
...
4040
}
@@ -96,7 +96,7 @@ This query finds the ``format`` argument passed into each call to ``String.init(
9696
9797
import swift
9898
99-
from CallExpr call, MethodDecl method
99+
from CallExpr call, Method method
100100
where
101101
call.getStaticTarget() = method and
102102
method.hasQualifiedName("String", "init(format:_:)")
@@ -110,7 +110,7 @@ So we use local data flow to find all expressions that flow into the argument:
110110
import swift
111111
import codeql.swift.dataflow.DataFlow
112112
113-
from CallExpr call, MethodDecl method, Expr sourceExpr, Expr sinkExpr
113+
from CallExpr call, Method method, Expr sourceExpr, Expr sinkExpr
114114
where
115115
call.getStaticTarget() = method and
116116
method.hasQualifiedName("String", "init(format:_:)") and
@@ -247,7 +247,7 @@ The following global taint-tracking query finds places where a string literal is
247247
248248
from DataFlow::Node sourceNode, DataFlow::Node sinkNode
249249
where ConstantPasswordFlow::flow(sourceNode, sinkNode)
250-
select sinkNode, "The value '" + sourceNode.toString() + "' is used as a constant password."
250+
select sinkNode, "The value $@ is used as a constant password.", sourceNode, sourceNode.toString()
251251
252252
253253
The following global taint-tracking query finds places where a value from a remote or local user input is used as an argument to the SQLite ``Connection.execute(_:)`` function.
@@ -267,7 +267,7 @@ The following global taint-tracking query finds places where a value from a remo
267267
268268
predicate isSink(DataFlow::Node node) {
269269
exists(CallExpr call |
270-
call.getStaticTarget().(MethodDecl).hasQualifiedName("Connection", "execute(_:)") and
270+
call.getStaticTarget().(Method).hasQualifiedName("Connection", "execute(_:)") and
271271
call.getArgument(0).getExpr() = node.asExpr()
272272
)
273273
}

0 commit comments

Comments
 (0)