File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
csharp/ql/test/query-tests/Security Features/CWE-089 Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace TestSqlite
4
4
{
5
-
5
+ using System . Data ;
6
6
using System . Data . SQLite ;
7
7
using System . Web . UI . WebControls ;
8
8
@@ -22,6 +22,21 @@ public void InjectUntrustedData()
22
22
cmd = new SQLiteCommand ( untrustedData . Text , connection ) ;
23
23
}
24
24
25
+ SQLiteDataAdapter adapter ;
26
+ DataSet result ;
27
+
28
+ // BAD: untrusted data is not sanitized.
29
+ using ( var connection = new SQLiteConnection ( connectionString ) )
30
+ {
31
+ adapter = new SQLiteDataAdapter ( untrustedData . Text , connection ) ;
32
+ result = new DataSet ( ) ;
33
+ adapter . Fill ( result ) ;
34
+ }
35
+
36
+ // BAD: untrusted data is not sanitized.
37
+ adapter = new SQLiteDataAdapter ( untrustedData . Text , connectionString ) ;
38
+ result = new DataSet ( ) ;
39
+ adapter . Fill ( result ) ;
25
40
}
26
41
}
27
42
}
You can’t perform that action at this time.
0 commit comments