Skip to content

Commit 592a422

Browse files
committed
C#: Fix test for InsecureSQLConnection.ql
1 parent 7b204ce commit 592a422

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

csharp/ql/test/query-tests/Security Features/CWE-327/InsecureSQLConnection/InsecureSQLConnection.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ public void StringInBuilderProperty()
3434

3535
public void TriggerThis()
3636
{
37-
// BAD, Encrypt not specified [NOT DETECTED]
37+
// BAD, Encrypt not specified
3838
SqlConnection conn = new SqlConnection("Server=myServerName\\myInstanceName;Database=myDataBase;User Id=myUsername;");
3939
}
4040

4141
void Test4()
4242
{
4343
string connectString =
4444
"Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd";
45-
// BAD, Encrypt not specified [NOT DETECTED]
45+
// BAD, Encrypt not specified
4646
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(connectString);
4747
var conn = new SqlConnection(builder.ConnectionString);
4848
}
@@ -51,7 +51,7 @@ void Test5()
5151
{
5252
string connectString =
5353
"Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd;Encrypt=false";
54-
// BAD, Encrypt set to false [NOT DETECTED]
54+
// BAD, Encrypt set to false
5555
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(connectString);
5656
var conn = new SqlConnection(builder.ConnectionString);
5757
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
edges
2+
| InsecureSQLConnection.cs:44:17:44:64 | "Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd" : String | InsecureSQLConnection.cs:46:81:46:93 | access to local variable connectString |
3+
| InsecureSQLConnection.cs:53:17:53:78 | "Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd;Encrypt=false" : String | InsecureSQLConnection.cs:55:81:55:93 | access to local variable connectString |
4+
nodes
5+
| InsecureSQLConnection.cs:38:52:38:128 | "Server=myServerName\\myInstanceName;Database=myDataBase;User Id=myUsername;" | semmle.label | "Server=myServerName\\myInstanceName;Database=myDataBase;User Id=myUsername;" |
6+
| InsecureSQLConnection.cs:44:17:44:64 | "Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd" : String | semmle.label | "Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd" : String |
7+
| InsecureSQLConnection.cs:46:81:46:93 | access to local variable connectString | semmle.label | access to local variable connectString |
8+
| InsecureSQLConnection.cs:53:17:53:78 | "Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd;Encrypt=false" : String | semmle.label | "Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd;Encrypt=false" : String |
9+
| InsecureSQLConnection.cs:55:81:55:93 | access to local variable connectString | semmle.label | access to local variable connectString |
10+
#select
11+
| InsecureSQLConnection.cs:38:52:38:128 | "Server=myServerName\\myInstanceName;Database=myDataBase;User Id=myUsername;" | InsecureSQLConnection.cs:38:52:38:128 | "Server=myServerName\\myInstanceName;Database=myDataBase;User Id=myUsername;" | InsecureSQLConnection.cs:38:52:38:128 | "Server=myServerName\\myInstanceName;Database=myDataBase;User Id=myUsername;" | $@ flows to here and does not specify `Encrypt=True`. | InsecureSQLConnection.cs:38:52:38:128 | "Server=myServerName\\myInstanceName;Database=myDataBase;User Id=myUsername;" | Connection string |
12+
| InsecureSQLConnection.cs:46:81:46:93 | access to local variable connectString | InsecureSQLConnection.cs:44:17:44:64 | "Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd" : String | InsecureSQLConnection.cs:46:81:46:93 | access to local variable connectString | $@ flows to here and does not specify `Encrypt=True`. | InsecureSQLConnection.cs:44:17:44:64 | "Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd" | Connection string |
13+
| InsecureSQLConnection.cs:55:81:55:93 | access to local variable connectString | InsecureSQLConnection.cs:53:17:53:78 | "Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd;Encrypt=false" : String | InsecureSQLConnection.cs:55:81:55:93 | access to local variable connectString | $@ flows to here and does not specify `Encrypt=True`. | InsecureSQLConnection.cs:53:17:53:78 | "Server=1.2.3.4;Database=Anything;UID=ab;Pwd=cd;Encrypt=false" | Connection string |
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Security Features/CWE-091/XMLInjection.ql
1+
Security Features/CWE-327/InsecureSQLConnection.ql

0 commit comments

Comments
 (0)