Skip to content

Commit 8df7fbf

Browse files
committed
Swift: update test output
The 'first' field is seen as a TaintInheritingContent, which means any read step for 'first' becomes a taint step too. This type of taint step does not permit an implicit read before it, because it wasn't contributed by a configuration. So there is no way for the taint to get out of the collection content before the taint step through '.first'. The test previously passed because an implicit read at once of the earlier sinks could follow use-use flow down to the receiver of .first, allowing it to escape the collection content.
1 parent d27b28d commit 8df7fbf

File tree

1 file changed

+2
-2
lines changed
  • swift/ql/test/library-tests/dataflow/taint/libraries

1 file changed

+2
-2
lines changed

swift/ql/test/library-tests/dataflow/taint/libraries/set.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func testSet(ix: Int) {
2828
sink(arg: taintedSet.max()!) // $ tainted=t1
2929
sink(arg: taintedSet.firstIndex(of: source("t2"))!)
3030
sink(arg: taintedSet[taintedSet.firstIndex(of: source("t3"))!]) // $ tainted=t1
31-
sink(arg: taintedSet.first!) // $ tainted=t1
31+
sink(arg: taintedSet.first!) // $ MISSING: tainted=t1
3232
for elem in taintedSet {
3333
sink(arg: elem) // $ tainted=t1
3434
}
@@ -100,7 +100,7 @@ func testSet(ix: Int) {
100100
sink(arg: taintedSet.sorted().randomElement()!) // $ tainted=t1
101101
sink(arg: taintedSet.shuffled().randomElement()!) // $ tainted=t1
102102

103-
sink(arg: taintedSet.lazy[taintedSet.firstIndex(of: source("t11"))!]) // $ tainted=t1
103+
sink(arg: taintedSet.lazy[taintedSet.firstIndex(of: source("t11"))!]) // $ MISSING: tainted=t1
104104

105105
var it = taintedSet.makeIterator()
106106
sink(arg: it.next()!) // $ tainted=t1

0 commit comments

Comments
 (0)