mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
C#/Java: Address review comments.
This commit is contained in:
@@ -58,15 +58,18 @@ class ExternalApi extends DataFlowDispatch::DataFlowCallable {
|
||||
*/
|
||||
string getInfo() { result = this.getInfoPrefix() + "#" + this.getSignature() }
|
||||
|
||||
/** Gets a call to this API callable. */
|
||||
DispatchCall getACall() {
|
||||
exists(DataFlowDispatch::NonDelegateDataFlowCall call | call.getDispatchCall() = result |
|
||||
this = result.getADynamicTarget().getUnboundDeclaration()
|
||||
or
|
||||
this = result.getAStaticTarget().getUnboundDeclaration()
|
||||
)
|
||||
}
|
||||
|
||||
/** Gets a node that is an input to a call to this API. */
|
||||
private ArgumentNode getAnInput() {
|
||||
exists(DispatchCall call |
|
||||
result.getCall().(DataFlowDispatch::NonDelegateDataFlowCall).getDispatchCall() = call
|
||||
|
|
||||
this = call.getADynamicTarget().getUnboundDeclaration()
|
||||
or
|
||||
this = call.getAStaticTarget().getUnboundDeclaration()
|
||||
)
|
||||
result.getCall().(DataFlowDispatch::NonDelegateDataFlowCall).getDispatchCall() = this.getACall()
|
||||
}
|
||||
|
||||
/** Gets a node that is an output from a call to this API. */
|
||||
@@ -74,9 +77,7 @@ class ExternalApi extends DataFlowDispatch::DataFlowCallable {
|
||||
exists(DataFlowDispatch::NonDelegateDataFlowCall call, DataFlowImplCommon::ReturnKindExt ret |
|
||||
result = ret.getAnOutNode(call)
|
||||
|
|
||||
this = call.getDispatchCall().getADynamicTarget().getUnboundDeclaration()
|
||||
or
|
||||
this = call.getDispatchCall().getAStaticTarget().getUnboundDeclaration()
|
||||
this.getACall() = call.getDispatchCall()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,14 +6,15 @@
|
||||
* @id csharp/telemetry/external-libs
|
||||
*/
|
||||
|
||||
import csharp
|
||||
import ExternalApi
|
||||
private import csharp
|
||||
private import semmle.code.csharp.dispatch.Dispatch
|
||||
private import ExternalApi
|
||||
|
||||
from int usages, string info
|
||||
where
|
||||
usages =
|
||||
strictcount(Call c, ExternalApi api |
|
||||
c.getTarget().getUnboundDeclaration() = api and
|
||||
strictcount(DispatchCall c, ExternalApi api |
|
||||
c = api.getACall() and
|
||||
api.getInfoPrefix() = info and
|
||||
not api.isUninteresting()
|
||||
)
|
||||
|
||||
@@ -6,12 +6,13 @@
|
||||
* @id csharp/telemetry/supported-external-api-sinks
|
||||
*/
|
||||
|
||||
import csharp
|
||||
import ExternalApi
|
||||
private import csharp
|
||||
private import semmle.code.csharp.dispatch.Dispatch
|
||||
private import ExternalApi
|
||||
|
||||
from ExternalApi api, int usages
|
||||
where
|
||||
not api.isUninteresting() and
|
||||
api.isSink() and
|
||||
usages = strictcount(Call c | c.getTarget().getUnboundDeclaration() = api)
|
||||
usages = strictcount(DispatchCall c | c = api.getACall())
|
||||
select api.getInfo() as info, usages order by usages desc
|
||||
|
||||
@@ -6,12 +6,13 @@
|
||||
* @id csharp/telemetry/supported-external-api-sources
|
||||
*/
|
||||
|
||||
import csharp
|
||||
import ExternalApi
|
||||
private import csharp
|
||||
private import semmle.code.csharp.dispatch.Dispatch
|
||||
private import ExternalApi
|
||||
|
||||
from ExternalApi api, int usages
|
||||
where
|
||||
not api.isUninteresting() and
|
||||
api.isSource() and
|
||||
usages = strictcount(Call c | c.getTarget().getUnboundDeclaration() = api)
|
||||
usages = strictcount(DispatchCall c | c = api.getACall())
|
||||
select api.getInfo() as info, usages order by usages desc
|
||||
|
||||
@@ -6,12 +6,13 @@
|
||||
* @id csharp/telemetry/supported-external-api-taint
|
||||
*/
|
||||
|
||||
import csharp
|
||||
import ExternalApi
|
||||
private import csharp
|
||||
private import semmle.code.csharp.dispatch.Dispatch
|
||||
private import ExternalApi
|
||||
|
||||
from ExternalApi api, int usages
|
||||
where
|
||||
not api.isUninteresting() and
|
||||
api.hasSummary() and
|
||||
usages = strictcount(Call c | c.getTarget().getUnboundDeclaration() = api)
|
||||
usages = strictcount(DispatchCall c | c = api.getACall())
|
||||
select api.getInfo() as info, usages order by usages desc
|
||||
|
||||
@@ -6,12 +6,13 @@
|
||||
* @id csharp/telemetry/unsupported-external-api
|
||||
*/
|
||||
|
||||
import csharp
|
||||
import ExternalApi
|
||||
private import csharp
|
||||
private import semmle.code.csharp.dispatch.Dispatch
|
||||
private import ExternalApi
|
||||
|
||||
from ExternalApi api, int usages
|
||||
where
|
||||
not api.isUninteresting() and
|
||||
not api.isSupported() and
|
||||
usages = strictcount(Call c | c.getTarget().getUnboundDeclaration() = api)
|
||||
usages = strictcount(DispatchCall c | c = api.getACall())
|
||||
select api.getInfo() as info, usages order by usages desc
|
||||
|
||||
Reference in New Issue
Block a user