Skip to content

Commit fd67c34

Browse files
committed
C#: Add sinks and summaries for adapters with tainted commands.
1 parent 78cfb22 commit fd67c34

File tree

1 file changed

+18
-0
lines changed
  • csharp/ql/lib/semmle/code/csharp/frameworks

1 file changed

+18
-0
lines changed

csharp/ql/lib/semmle/code/csharp/frameworks/Sql.qll

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,30 @@ private class IDbCommandConstructionSinkModelCsv extends SinkModelCsv {
7777
}
7878
}
7979

80+
/** Data flow for SqlCommand and friends. */
81+
private class SqlCommandSummaryModelCsv extends SummaryModelCsv {
82+
override predicate row(string row) {
83+
row =
84+
[
85+
// SqlCommand
86+
"System.Data.SqlClient;SqlCommand;false;SqlCommand;(System.String);;Argument[0];Argument[Qualifier];taint;manual",
87+
"System.Data.SqlClient;SqlCommand;false;SqlCommand;(System.String,System.Data.SqlClient.SqlConnection);;Argument[0];Argument[Qualifier];taint;manual",
88+
"System.Data.SqlClient;SqlCommand;false;SqlCommand;(System.String,System.Data.SqlClient.SqlConnection,System.Data.SqlClient.SqlTransaction);;Argument[0];Argument[Qualifier];taint;manual",
89+
// SQLiteCommand.
90+
"System.Data.SQLite;SQLiteCommand;false;SQLiteCommand;(System.String);;Argument[0];Argument[Qualifier];taint;manual",
91+
"System.Data.SQLite;SQLiteCommand;false;SQLiteCommand;(System.String,System.Data.SQLite.SQLiteConnection);;Argument[0];Argument[Qualifier];taint;manual",
92+
"System.Data.SQLite;SQLiteCommand;false;SQLiteCommand;(System.String,System.Data.SQLite.SQLiteConnection,System.Data.SQLite.SQLiteTransaction);;Argument[0];Argument[Qualifier];taint;manual",
93+
]
94+
}
95+
}
96+
8097
/** A construction of an `Adapter` object. */
8198
private class SqlDataAdapterConstructionSinkModelCsv extends SinkModelCsv {
8299
override predicate row(string row) {
83100
row =
84101
[
85102
// SqlDataAdapter
103+
"System.Data.SqlClient;SqlDataAdapter;false;SqlDataAdapter;(System.Data.SqlClient.SqlCommand);;Argument[0];sql;manual",
86104
"System.Data.SqlClient;SqlDataAdapter;false;SqlDataAdapter;(System.String,System.String);;Argument[0];sql;manual",
87105
"System.Data.SqlClient;SqlDataAdapter;false;SqlDataAdapter;(System.String,System.Data.SqlClient.SqlConnection);;Argument[0];sql;manual",
88106
// SQLiteDataAdapter

0 commit comments

Comments
 (0)