You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CodeQL scan is not picking up SQL Injection vulnerability in the following Azure Function trigger:
using System.Net;using Microsoft.Azure.Functions.Worker;using Microsoft.Azure.Functions.Worker.Http;using Microsoft.Data.Sqlite;using Microsoft.Extensions.Logging;using Dapper;namespace DavidF.Demo.GithubActions.Functions;publicclassHelloWorldFunction{privatereadonlySqliteConnection_sqliteConnection;privatereadonlyILogger_logger;publicHelloWorldFunction(ILoggerFactoryloggerFactory,SqliteConnectionsqliteConnection){_sqliteConnection=sqliteConnection;_logger= loggerFactory.CreateLogger<HelloWorldFunction>();}[Function("HelloWorldFunction")]publicasyncTask<HttpResponseData>Run([HttpTrigger(AuthorizationLevel.Function,"get","post")]HttpRequestDatareq){
_logger.LogInformation("C# HTTP trigger function processed a request.");varsql=$"SELECT * FROM USER WHERE Name = '{req.Query["name"]}'";
_sqliteConnection.Open();varres=await _sqliteConnection.QueryAsync<UserDto>(sql);varresponse= req.CreateResponse(HttpStatusCode.OK);await response.WriteAsJsonAsync(res);returnresponse;}publicrecordUserDto(longId,stringName);}
Tested in GitHub actions and also locally using CLI:
Thank you for reporting this issue. The reason for not finding the SQL injection is that we don't have any models for Azure Functions, so we don't find the req parameter as a flow source. I created an internal issue to model Azure Function libraries.
Description of the issue
CodeQL scan is not picking up SQL Injection vulnerability in the following Azure Function trigger:
Tested in GitHub actions and also locally using CLI:
The text was updated successfully, but these errors were encountered: