Hello everyone,
I am new to SonarQube. I tried using the search, but I did not find an answer, so apologies if this is a common question.
I am running SonarQube 7.9.1 on Ubuntu. I have also installed version 3.3.0.1492 of SonarScanner. I am going through the getting started tutorial that is presented when you start the console and browse http://127.0.0.1:9000.
I made a simple C# application that is vulnerable to SQL injection. See below.
static void Main(string[] args)
{
int i = 0;
VeryVeryBadSQL(args[0]);
}
static void VeryVeryBadSQL(string pId)
{
SqlConnection conn = new SqlConnection("SomeConnectionString");
SqlCommand comm = new SqlCommand();
comm.Connection = conn;
comm.Connection.Open();
comm.CommandType = System.Data.CommandType.Text;
comm.CommandText = "SELECT * FROM SomeTable WHERE ID = '" + pId + "'";
var reader = comm.ExecuteReader();
}
When running SonarScanner against this, no SQL injection vulnerabilities are identified. Why is this? Do I need to add a plugin or something? If so, can someone direct me to a resource that shows how to do this?
Thanks,
Must-share information (formatted with Markdown):
- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
- what are you trying to achieve
- what have you tried so far to achieve this