File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
rust/ql/test/library-tests/dataflow/sources Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,12 @@ module MyFlowConfig implements DataFlow::ConfigSig {
14
14
.getArgList ( )
15
15
.getAnArg ( ) = sink .asExpr ( ) .getExpr ( )
16
16
}
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
+ }
17
23
}
18
24
19
25
module MyFlowTest = TaintFlowTest< MyFlowConfig > ;
Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ fn sink<T>(_: T) { }
5
5
// --- tests ---
6
6
7
7
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"
10
10
11
11
let var1 = std:: env:: var ( "HOME" ) . expect ( "HOME not set" ) ; // $ Alert[rust/summary/taint-sources]
12
12
let var2 = std:: env:: var_os ( "PATH" ) . unwrap ( ) ; // $ Alert[rust/summary/taint-sources]
You can’t perform that action at this time.
0 commit comments