Skip to content

Commit be40085

Browse files
committed
Rust: Add a test of flow sources reaching sinks as well.
1 parent a85ad4e commit be40085

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

rust/ql/test/library-tests/dataflow/sources/InlineFlow.expected

Whitespace-only changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import rust
2+
import codeql.rust.dataflow.DataFlow
3+
import codeql.rust.Concepts
4+
import utils.InlineFlowTest
5+
6+
/**
7+
* Configuration for flow from any threat model source to an argument of a function called `sink`.
8+
*/
9+
module MyFlowConfig implements DataFlow::ConfigSig {
10+
predicate isSource(DataFlow::Node source) { source instanceof ThreatModelSource }
11+
12+
predicate isSink(DataFlow::Node sink) {
13+
any(CallExpr call | call.getExpr().(PathExpr).getPath().toString() = "sink")
14+
.getArgList()
15+
.getAnArg() = sink.asExpr()
16+
}
17+
}
18+
19+
module MyFlowTest = TaintFlowTest<MyFlowConfig>;
20+
21+
import MyFlowTest

0 commit comments

Comments
 (0)