I have been searching the internet for WiQL injection protection guides and have not found anything yet. This is for the Azure Dev Ops (ADO) previously known as Visual Studio Team Services (VSTS) API.
For this code, how should I prevent WiQL injection? The documentation does not show anything about preventing injection attacks here. What is the advice here? Just prevent ' characters?
string projectName = "user supplied input";
string tenantId= "user supplied input";
var wiql = new Wiql()
{
Query = $@"Select [Id] From WorkItems
Where [System.TeamProject] = '{projectName}'
And [Custom.TenantId] = '{tenantId}'
Order By [State] Asc, [Changed Date] Desc"
};
// create instance of work item tracking http client
var adoUri = new Uri($"{VSTS_URL}");
using (var trackingClient = new WorkItemTrackingHttpClient(adoUri, credentials))
{
// execute the query to get the list of work items in the results
var result = await trackingClient.QueryByWiqlAsync(wiql);
}