Skip to content

Commit e1efae5

Browse files
committed
PS: Add another SQL injection FP.
1 parent 9681711 commit e1efae5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

powershell/ql/test/query-tests/security/cwe-089/SqlInjection.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ edges
55
| test.ps1:1:1:1:10 | userinput | test.ps1:28:24:28:76 | SELECT * FROM MyTable WHERE MyColumn = '$userinput' | provenance | |
66
| test.ps1:1:1:1:10 | userinput | test.ps1:78:13:78:22 | userinput | provenance | |
77
| test.ps1:1:1:1:10 | userinput | test.ps1:128:28:128:37 | userinput | provenance | |
8+
| test.ps1:1:1:1:10 | userinput | test.ps1:141:15:141:24 | userinput | provenance | |
89
| test.ps1:1:14:1:45 | Call to read-host | test.ps1:1:1:1:10 | userinput | provenance | Src:MaD:0 |
910
| test.ps1:4:1:4:6 | query | test.ps1:5:72:5:77 | query | provenance | |
1011
| test.ps1:8:1:8:6 | query | test.ps1:9:72:9:77 | query | provenance | |
@@ -29,6 +30,7 @@ nodes
2930
| test.ps1:121:9:121:56 | unvalidated | semmle.label | unvalidated |
3031
| test.ps1:125:92:125:103 | unvalidated | semmle.label | unvalidated |
3132
| test.ps1:128:28:128:37 | userinput | semmle.label | userinput |
33+
| test.ps1:141:15:141:24 | userinput | semmle.label | userinput |
3234
subpaths
3335
#select
3436
| test.ps1:5:72:5:77 | query | test.ps1:1:14:1:45 | Call to read-host | test.ps1:5:72:5:77 | query | This SQL query depends on a $@. | test.ps1:1:14:1:45 | Call to read-host | read from stdin |
@@ -37,3 +39,4 @@ subpaths
3739
| test.ps1:28:24:28:76 | SELECT * FROM MyTable WHERE MyColumn = '$userinput' | test.ps1:1:14:1:45 | Call to read-host | test.ps1:28:24:28:76 | SELECT * FROM MyTable WHERE MyColumn = '$userinput' | This SQL query depends on a $@. | test.ps1:1:14:1:45 | Call to read-host | read from stdin |
3840
| test.ps1:81:15:81:25 | QueryConn2 | test.ps1:1:14:1:45 | Call to read-host | test.ps1:81:15:81:25 | QueryConn2 | This SQL query depends on a $@. | test.ps1:1:14:1:45 | Call to read-host | read from stdin |
3941
| test.ps1:125:92:125:103 | unvalidated | test.ps1:1:14:1:45 | Call to read-host | test.ps1:125:92:125:103 | unvalidated | This SQL query depends on a $@. | test.ps1:1:14:1:45 | Call to read-host | read from stdin |
42+
| test.ps1:141:15:141:24 | userinput | test.ps1:1:14:1:45 | Call to read-host | test.ps1:141:15:141:24 | userinput | This SQL query depends on a $@. | test.ps1:1:14:1:45 | Call to read-host | read from stdin |

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,6 @@ $QueryConn3 = @{
136136
inputfile = $userinput
137137
}
138138

139-
Invoke-Sqlcmd @QueryConn3 # GOOD
139+
Invoke-Sqlcmd @QueryConn3 # GOOD
140+
141+
&sqlcmd -e -S $userinput -U "Login" -P "MyPassword" -d "MyDBName" -i "input_file.sql" # GOOD [FALSE POSITIVE]

0 commit comments

Comments
 (0)