Skip to content

Commit b5fb6b5

Browse files
committed
PS: Fix FP by also considering -q and -i parameters.
1 parent 6501d12 commit b5fb6b5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,19 @@ module SqlInjection {
4848
override string getSourceType() { result = this.(SourceNode).getSourceType() }
4949
}
5050

51+
private string query() { result = ["query", "q"] }
52+
53+
private string inputfile() { result = ["inputfile", "i"] }
54+
5155
class InvokeSqlCmdSink extends Sink {
5256
InvokeSqlCmdSink() {
5357
exists(DataFlow::CallNode call | call.matchesName("Invoke-Sqlcmd") |
54-
this = call.getNamedArgument("query")
58+
this = call.getNamedArgument(query())
5559
or
56-
this = call.getNamedArgument("inputfile")
60+
this = call.getNamedArgument(inputfile())
5761
or
58-
not call.hasNamedArgument("query") and
59-
not call.hasNamedArgument("inputfile") and
62+
not call.hasNamedArgument(query()) and
63+
not call.hasNamedArgument(inputfile()) and
6064
this = call.getArgument(0)
6165
or
6266
// TODO: Here we really should pick a splat argument, but we don't yet extract whether an

0 commit comments

Comments
 (0)