Skip to content

Commit 68e7f84

Browse files
authored
Merge pull request #14661 from geoffw0/commandinject4
Swift: Fix defaultImplicitTaintRead on fields
2 parents 6b434d1 + 48c3db2 commit 68e7f84

File tree

4 files changed

+262
-193
lines changed

4 files changed

+262
-193
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
5+
* Fixed a bug where some flow sinks at field accesses were not being correctly identified.

swift/ql/lib/codeql/swift/dataflow/internal/TaintTrackingPublic.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ predicate defaultImplicitTaintRead(DataFlow::Node node, DataFlow::ContentSet cs)
3232
// So when the node is a `PostUpdateNode` we allow any sequence of implicit read steps of an appropriate
3333
// type to make sure we arrive at the sink with an empty access path.
3434
exists(NominalTypeDecl d, Decl cx |
35-
node.(DataFlow::PostUpdateNode).getPreUpdateNode().asExpr().getType().getUnderlyingType() =
36-
d.getType().getABaseType*() and
35+
node.(DataFlow::PostUpdateNode)
36+
.getPreUpdateNode()
37+
.asExpr()
38+
.getType()
39+
.getUnderlyingType()
40+
.getABaseType*() = d.getType() and
3741
cx.asNominalTypeDecl() = d and
3842
cs.getAReadContent().(DataFlow::Content::FieldContent).getField() = cx.getAMember()
3943
)

0 commit comments

Comments
 (0)