Merge pull request #10606 from hvitved/csharp/unsupported-api-meta-query

C#: Add meta query for reporting calls to unsupported library methods
This commit is contained in:
Tom Hvitved
2022-09-28 18:52:07 +02:00
committed by GitHub

View File

@@ -0,0 +1,23 @@
/**
* @name Usage of unsupported external library API
* @description A call to an unsuppported external library API.
* @kind problem
* @problem.severity recommendation
* @tags meta
* @id csharp/meta/unsupported-external-api
* @precision very-low
*/
private import csharp
private import semmle.code.csharp.dispatch.Dispatch
private import semmle.code.csharp.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
private import semmle.code.csharp.dataflow.internal.NegativeSummary
private import Telemetry.ExternalApi
from DispatchCall c, ExternalApi api
where
c = api.getACall() and
not api.isUninteresting() and
not api.isSupported() and
not api instanceof FlowSummaryImpl::Public::NegativeSummarizedCallable
select c, "Call to unsupported external API $@.", api, api.toString()