mirror of
https://github.com/github/codeql.git
synced 2026-05-01 11:45:14 +02:00
C#/Java: Make configurations private and sprinkle some QL Doc.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
private import CaptureSinkModelsSpecific
|
||||
|
||||
class PropagateToSinkConfiguration extends PropagateToSinkConfigurationSpecific {
|
||||
private class PropagateToSinkConfiguration extends PropagateToSinkConfigurationSpecific {
|
||||
PropagateToSinkConfiguration() { this = "parameters or fields flowing into sinks" }
|
||||
|
||||
override predicate isSink(DataFlow::Node sink) { sinkNode(sink, _) }
|
||||
@@ -10,6 +10,9 @@ class PropagateToSinkConfiguration extends PropagateToSinkConfigurationSpecific
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sink model(s) of `api`, if there is flow from a parameter to an existing known sink.
|
||||
*/
|
||||
string captureSink(TargetApi api) {
|
||||
exists(DataFlow::Node src, DataFlow::Node sink, PropagateToSinkConfiguration config, string kind |
|
||||
config.hasFlow(src, sink) and
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
private import CaptureSourceModelsSpecific
|
||||
private import ModelGeneratorUtils
|
||||
|
||||
class FromSourceConfiguration extends TaintTracking::Configuration {
|
||||
private class FromSourceConfiguration extends TaintTracking::Configuration {
|
||||
FromSourceConfiguration() { this = "FromSourceConfiguration" }
|
||||
|
||||
override predicate isSource(DataFlow::Node source) { sourceNode(source, _) }
|
||||
@@ -22,6 +22,9 @@ class FromSourceConfiguration extends TaintTracking::Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the source model(s) of `api`, if there is flow from an existing known source to the return of `api`.
|
||||
*/
|
||||
string captureSource(TargetApi api) {
|
||||
exists(DataFlow::Node source, DataFlow::Node sink, FromSourceConfiguration config, string kind |
|
||||
config.hasFlow(source, sink) and
|
||||
|
||||
@@ -36,7 +36,7 @@ private class TaintStore extends DataFlow::FlowState {
|
||||
*
|
||||
* This can be used to generate Flow summaries for APIs from parameter to return.
|
||||
*/
|
||||
class ThroughFlowConfig extends TaintTracking::Configuration {
|
||||
private class ThroughFlowConfig extends TaintTracking::Configuration {
|
||||
ThroughFlowConfig() { this = "ThroughFlowConfig" }
|
||||
|
||||
override predicate isSource(DataFlow::Node source, DataFlow::FlowState state) {
|
||||
|
||||
@@ -8,8 +8,17 @@ import semmle.code.csharp.dataflow.internal.DataFlowImplCommon
|
||||
import semmle.code.csharp.dataflow.internal.DataFlowPrivate
|
||||
import ModelGeneratorUtils
|
||||
|
||||
/**
|
||||
* Gets the enclosing callable of `ret`.
|
||||
*/
|
||||
Callable returnNodeEnclosingCallable(ReturnNodeExt ret) { result = getNodeEnclosingCallable(ret) }
|
||||
|
||||
/**
|
||||
* Holds if `node` is an own instance access.
|
||||
*/
|
||||
predicate isOwnInstanceAccessNode(ReturnNode node) { node.asExpr() instanceof ThisAccess }
|
||||
|
||||
/**
|
||||
* Gets the CSV string representation of the qualifier.
|
||||
*/
|
||||
string qualifierString() { result = "Argument[Qualifier]" }
|
||||
|
||||
@@ -5,6 +5,9 @@ private import semmle.code.csharp.commons.Collections
|
||||
private import semmle.code.csharp.dataflow.internal.DataFlowImplCommon
|
||||
private import semmle.code.csharp.dataflow.internal.DataFlowDispatch
|
||||
|
||||
/**
|
||||
* Holds if it is relevant to generate models for `api`.
|
||||
*/
|
||||
predicate isRelevantForModels(Callable api) { not api instanceof MainMethod }
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user