【发布时间】:2021-03-13 14:55:32
【问题描述】:
我一直在互联网上搜索 WiQL 注入保护指南,但尚未找到任何内容。这适用于以前称为 Visual Studio Team Services (VSTS) API 的 Azure Dev Ops (ADO)。
对于这段代码,我应该如何防止 WiQL 注入? The documentation 在这里没有显示任何关于防止注入攻击的信息。这里有什么建议?只是防止 ' 字符?
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);
}
【问题讨论】:
-
能否详细说明“WiQL 注入保护”?您的意思是您不希望用户使用 DevOps REST api 运行查询吗?这里的WIQL只能查看工作项,不会向数据库注入任何数据。
-
您的问题有什么更新吗?
-
您希望用户能够为查询提供单个值。租户 ID。用户名。等等。你不希望他们能够指定“tenantId”或“1”=“1”并突然拉出大量条目。你知道的。标准 SQL 注入,但这次使用的是 WiQL。 @CeceDong-MSFT
标签: security azure-devops wiql