Skip to content

Commit de81a1c

Browse files
committed
C#: Allow implicit reads from collections in argument nodes (sinks and additional flow steps) for default taint tracking configurations.
1 parent af02191 commit de81a1c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/internal/TaintTrackingPrivate.qll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ private import semmle.code.csharp.dataflow.internal.DataFlowPrivate
77
private import semmle.code.csharp.dataflow.internal.ControlFlowReachability
88
private import semmle.code.csharp.dispatch.Dispatch
99
private import semmle.code.csharp.commons.ComparisonTest
10+
private import semmle.code.csharp.commons.Collections as Collections
1011
// import `TaintedMember` definitions from other files to avoid potential reevaluation
1112
private import semmle.code.csharp.frameworks.JsonNET
1213
private import semmle.code.csharp.frameworks.WCF
@@ -29,7 +30,11 @@ predicate defaultTaintSanitizer(DataFlow::Node node) {
2930
* of `c` at sinks and inputs to additional taint steps.
3031
*/
3132
bindingset[node]
32-
predicate defaultImplicitTaintRead(DataFlow::Node node, DataFlow::ContentSet c) { none() }
33+
predicate defaultImplicitTaintRead(DataFlow::Node node, DataFlow::ContentSet c) {
34+
node instanceof ArgumentNode and
35+
Collections::isCollectionType(node.getType()) and
36+
c.isElement()
37+
}
3338

3439
private class LocalTaintExprStepConfiguration extends ControlFlowReachabilityConfiguration {
3540
LocalTaintExprStepConfiguration() { this = "LocalTaintExprStepConfiguration" }

0 commit comments

Comments
 (0)