Skip to content

Commit

Permalink
PS: Add tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
MathiasVP committed Nov 8, 2024
1 parent 40cf8dd commit b3de6a2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
edges
| test.ps1:1:8:1:10 | x | test.ps1:3:28:3:48 | Get-Process -Id $x | provenance | |
| test.ps1:5:10:5:21 | Env:MY_VAR | test.ps1:7:3:7:20 | $code --enabled | provenance | |
nodes
| test.ps1:1:8:1:10 | x | semmle.label | x |
| test.ps1:3:28:3:48 | Get-Process -Id $x | semmle.label | Get-Process -Id $x |
| test.ps1:5:10:5:21 | Env:MY_VAR | semmle.label | Env:MY_VAR |
| test.ps1:7:3:7:20 | $code --enabled | semmle.label | $code --enabled |
subpaths
#select
| test.ps1:3:28:3:48 | Get-Process -Id $x | test.ps1:1:8:1:10 | x | test.ps1:3:28:3:48 | Get-Process -Id $x | This command depends on a $@. | test.ps1:1:8:1:10 | x | user-provided value |
| test.ps1:7:3:7:20 | $code --enabled | test.ps1:5:10:5:21 | Env:MY_VAR | test.ps1:7:3:7:20 | $code --enabled | This command depends on a $@. | test.ps1:5:10:5:21 | Env:MY_VAR | user-provided value |
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
queries/security/cwe-078/CommandInjection.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
param ($x)

Invoke-Expression -Command "Get-Process -Id $x" # BAD

$code = "$Env:MY_VAR"

& "$code --enabled" # BAD

0 comments on commit b3de6a2

Please sign in to comment.