File tree Expand file tree Collapse file tree
csharp/ql/test/query-tests/Security Features/CWE-089 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33namespace TestSqlite
44{
5-
5+ using System . Data ;
66 using System . Data . SQLite ;
77 using System . Web . UI . WebControls ;
88
@@ -22,6 +22,21 @@ public void InjectUntrustedData()
2222 cmd = new SQLiteCommand ( untrustedData . Text , connection ) ;
2323 }
2424
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 ) ;
2540 }
2641 }
2742}
You can’t perform that action at this time.
0 commit comments