Skip to content

Commit 456ab98

Browse files
committed
Swift: Fix duplicate results.
1 parent 0cd2efc commit 456ab98

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

swift/ql/src/queries/Security/CWE-311/CleartextTransmission.ql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ class CleartextTransmissionConfig extends TaintTracking::Configuration {
7070
}
7171

7272
override predicate isSink(DataFlow::Node node) { node.asExpr() instanceof Transmitted }
73+
74+
override predicate isSanitizerIn(DataFlow::Node node) {
75+
// make sources barriers so that we only report the closest instance
76+
isSource(node)
77+
}
7378
}
7479

7580
from CleartextTransmissionConfig config, DataFlow::PathNode sourceNode, DataFlow::PathNode sinkNode

swift/ql/test/query-tests/Security/CWE-311/CleartextTransmission.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
edges
22
| testURL.swift:13:54:13:54 | passwd : | testURL.swift:13:22:13:54 | ... call to +(_:_:) ... |
3-
| testURL.swift:13:54:13:54 | passwd : | testURL.swift:20:22:20:22 | passwd |
43
| testURL.swift:16:55:16:55 | credit_card_no : | testURL.swift:16:22:16:55 | ... call to +(_:_:) ... |
54
nodes
65
| testSend.swift:29:19:29:19 | passwordPlain | semmle.label | passwordPlain |
@@ -14,5 +13,4 @@ subpaths
1413
| testSend.swift:29:19:29:19 | passwordPlain | testSend.swift:29:19:29:19 | passwordPlain | testSend.swift:29:19:29:19 | passwordPlain | This operation transmits 'passwordPlain', which may contain unencrypted sensitive data from $@ | testSend.swift:29:19:29:19 | passwordPlain | passwordPlain |
1514
| testURL.swift:13:22:13:54 | ... call to +(_:_:) ... | testURL.swift:13:54:13:54 | passwd : | testURL.swift:13:22:13:54 | ... call to +(_:_:) ... | This operation transmits '... call to +(_:_:) ...', which may contain unencrypted sensitive data from $@ | testURL.swift:13:54:13:54 | passwd : | passwd |
1615
| testURL.swift:16:22:16:55 | ... call to +(_:_:) ... | testURL.swift:16:55:16:55 | credit_card_no : | testURL.swift:16:22:16:55 | ... call to +(_:_:) ... | This operation transmits '... call to +(_:_:) ...', which may contain unencrypted sensitive data from $@ | testURL.swift:16:55:16:55 | credit_card_no : | credit_card_no |
17-
| testURL.swift:20:22:20:22 | passwd | testURL.swift:13:54:13:54 | passwd : | testURL.swift:20:22:20:22 | passwd | This operation transmits 'passwd', which may contain unencrypted sensitive data from $@ | testURL.swift:13:54:13:54 | passwd : | passwd |
1816
| testURL.swift:20:22:20:22 | passwd | testURL.swift:20:22:20:22 | passwd | testURL.swift:20:22:20:22 | passwd | This operation transmits 'passwd', which may contain unencrypted sensitive data from $@ | testURL.swift:20:22:20:22 | passwd | passwd |

0 commit comments

Comments
 (0)