Skip to content

Commit 2541bcd

Browse files
committed
PS: Add test cases.
1 parent 3f4a169 commit 2541bcd

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
models
2+
edges
3+
nodes
4+
subpaths
5+
testFailures
6+
#select
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
function WriteToEnvVar {
2+
$env:x = Source "1"
3+
}
4+
5+
function ReadFromEndVar {
6+
Sink $Env:x # $ MISSING: hasValueFlow=1 hasValueFlow=3
7+
}
8+
9+
function WriteAndThenOverWriteEnvVar {
10+
$env:x = Source "2"
11+
$env:x = 0
12+
}
13+
14+
function MaybeWriteToEnvVar($b) {
15+
if($b -eq $true) {
16+
$env:x = Source "3"
17+
} else {
18+
$env:x = 0
19+
}
20+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @kind path-problem
3+
*/
4+
5+
import powershell
6+
import semmle.code.powershell.dataflow.DataFlow
7+
private import TestUtilities.InlineFlowTest
8+
import DefaultFlowTest
9+
import ValueFlow::PathGraph
10+
11+
from ValueFlow::PathNode source, ValueFlow::PathNode sink
12+
where ValueFlow::flowPath(source, sink)
13+
select sink, source, sink, "$@", source, source.toString()

0 commit comments

Comments
 (0)