Skip to content

Commit bc99894

Browse files
author
dilanbhalla
committed
Merge branch 'main' of https://github.com/microsoft/codeql into auto/sync-main-pr
2 parents f2f18fe + 7a96fec commit bc99894

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

powershell/ql/lib/semmle/code/powershell/security/SqlInjectionCustomizations.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ module SqlInjection {
5757
exists(DataFlow::CallNode call | call.matchesName("Invoke-Sqlcmd") |
5858
this = call.getNamedArgument(query())
5959
or
60-
this = call.getNamedArgument(inputfile())
61-
or
60+
// If the input is not provided as a query parameter or an input file
61+
// parameter then it's the first argument.
6262
not call.hasNamedArgument(query()) and
6363
not call.hasNamedArgument(inputfile()) and
6464
this = call.getArgument(0)

powershell/ql/test/query-tests/security/cwe-089/test.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,6 @@ function TakesTypedParameters([int]$i, [long]$l, [float]$f, [double]$d, [decimal
109109
TakesTypedParameters $userinput $userinput $userinput $userinput $userinput $userinput $userinput $userinput
110110

111111
$query = "SELECT * FROM MyTable WHERE MyColumn = '$userinput'"
112-
Invoke-Sqlcmd -unknown $userinput -ServerInstance "MyServer" -Database "MyDatabase" -q "SELECT * FROM MyTable" # GOOD
112+
Invoke-Sqlcmd -unknown $userinput -ServerInstance "MyServer" -Database "MyDatabase" -q "SELECT * FROM MyTable" # GOOD
113+
114+
Invoke-Sqlcmd -ServerInstance "MyServer" -Database "MyDatabase" -InputFile $userinput # GOOD # this is not really what this query is about.

0 commit comments

Comments
 (0)