Skip to content

Commit 185a23b

Browse files
committed
Rust: Allow implicit flow out of content at the test sinks, so that we see our results.
1 parent a1980d4 commit 185a23b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ module MyFlowConfig implements DataFlow::ConfigSig {
1414
.getArgList()
1515
.getAnArg() = sink.asExpr().getExpr()
1616
}
17+
18+
predicate allowImplicitRead(DataFlow::Node node, DataFlow::ContentSet c) {
19+
// flow out from any content at the sink.
20+
isSink(node) and
21+
exists(c)
22+
}
1723
}
1824

1925
module MyFlowTest = TaintFlowTest<MyFlowConfig>;

rust/ql/test/library-tests/dataflow/sources/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ fn sink<T>(_: T) { }
55
// --- tests ---
66

77
fn test_env_vars() {
8-
sink(std::env::var("HOME")); // $ Alert[rust/summary/taint-sources] MISSING: hasTaintFlow
9-
sink(std::env::var_os("PATH")); // $ Alert[rust/summary/taint-sources] MISSING: hasTaintFlow
8+
sink(std::env::var("HOME")); // $ Alert[rust/summary/taint-sources] hasTaintFlow="HOME"
9+
sink(std::env::var_os("PATH")); // $ Alert[rust/summary/taint-sources] hasTaintFlow="PATH"
1010

1111
let var1 = std::env::var("HOME").expect("HOME not set"); // $ Alert[rust/summary/taint-sources]
1212
let var2 = std::env::var_os("PATH").unwrap(); // $ Alert[rust/summary/taint-sources]

0 commit comments

Comments
 (0)