Skip to content

Commit d114582

Browse files
committed
C#: Add QLDoc to the shared Capture summary models library.
1 parent 8d2593b commit d114582

File tree

2 files changed

+46
-24
lines changed

2 files changed

+46
-24
lines changed

csharp/ql/src/utils/model-generator/CaptureSummaryModels.qll

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1+
/**
2+
* Provides classes and predicates related to capturing summary models
3+
* of the Standard or a 3rd party library.
4+
*/
5+
16
import CaptureSummaryModelsSpecific
27

38
/**
4-
* Capture fluent APIs that return `this`.
5-
* Example of a fluent API:
6-
* ```
7-
* public class Foo {
8-
* public Foo someAPI() {
9-
* // some side-effect
10-
* return this;
11-
* }
12-
* }
13-
* ```
9+
* Gets the summary model of `api`, if it follows the `fluent` programming pattern (returns `this`).
1410
*/
1511
string captureQualifierFlow(TargetAPI api) {
1612
exists(ReturnStmt rtn |
@@ -20,14 +16,26 @@ string captureQualifierFlow(TargetAPI api) {
2016
result = asValueModel(api, qualifierString(), "ReturnValue")
2117
}
2218

23-
class TaintRead extends DataFlow::FlowState {
19+
/**
20+
* A FlowState representing a tainted read.
21+
*/
22+
private class TaintRead extends DataFlow::FlowState {
2423
TaintRead() { this = "TaintRead" }
2524
}
2625

27-
class TaintStore extends DataFlow::FlowState {
26+
/**
27+
* A FlowState representing a tainted write.
28+
*/
29+
private class TaintStore extends DataFlow::FlowState {
2830
TaintStore() { this = "TaintStore" }
2931
}
3032

33+
/**
34+
* A TaintTracking Configuration used for tracking flow through APIs.
35+
* The sources are the parameters of an API and the sinks are the return values (excluding `this`) and parameters.
36+
*
37+
* This can be used to generate Flow summaries for APIs from parameter to return.
38+
*/
3139
class ThroughFlowConfig extends TaintTracking::Configuration {
3240
ThroughFlowConfig() { this = "ThroughFlowConfig" }
3341

@@ -72,6 +80,9 @@ class ThroughFlowConfig extends TaintTracking::Configuration {
7280
}
7381
}
7482

83+
/**
84+
* Gets the summary model(s) of `api`, if there is flow from parameters to return value or parameter.
85+
*/
7586
string captureThroughFlow(TargetAPI api) {
7687
exists(
7788
ThroughFlowConfig config, DataFlow::ParameterNode p, ReturnNodeExt returnNodeExt, string input,

java/ql/src/utils/model-generator/CaptureSummaryModels.qll

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1+
/**
2+
* Provides classes and predicates related to capturing summary models
3+
* of the Standard or a 3rd party library.
4+
*/
5+
16
import CaptureSummaryModelsSpecific
27

38
/**
4-
* Capture fluent APIs that return `this`.
5-
* Example of a fluent API:
6-
* ```
7-
* public class Foo {
8-
* public Foo someAPI() {
9-
* // some side-effect
10-
* return this;
11-
* }
12-
* }
13-
* ```
9+
* Gets the summary model of `api`, if it follows the `fluent` programming pattern (returns `this`).
1410
*/
1511
string captureQualifierFlow(TargetApi api) {
1612
exists(ReturnStmt rtn |
@@ -20,14 +16,26 @@ string captureQualifierFlow(TargetApi api) {
2016
result = asValueModel(api, qualifierString(), "ReturnValue")
2117
}
2218

23-
class TaintRead extends DataFlow::FlowState {
19+
/**
20+
* A FlowState representing a tainted read.
21+
*/
22+
private class TaintRead extends DataFlow::FlowState {
2423
TaintRead() { this = "TaintRead" }
2524
}
2625

27-
class TaintStore extends DataFlow::FlowState {
26+
/**
27+
* A FlowState representing a tainted write.
28+
*/
29+
private class TaintStore extends DataFlow::FlowState {
2830
TaintStore() { this = "TaintStore" }
2931
}
3032

33+
/**
34+
* A TaintTracking Configuration used for tracking flow through APIs.
35+
* The sources are the parameters of an API and the sinks are the return values (excluding `this`) and parameters.
36+
*
37+
* This can be used to generate Flow summaries for APIs from parameter to return.
38+
*/
3139
class ThroughFlowConfig extends TaintTracking::Configuration {
3240
ThroughFlowConfig() { this = "ThroughFlowConfig" }
3341

@@ -72,6 +80,9 @@ class ThroughFlowConfig extends TaintTracking::Configuration {
7280
}
7381
}
7482

83+
/**
84+
* Gets the summary model(s) of `api`, if there is flow from parameters to return value or parameter.
85+
*/
7586
string captureThroughFlow(TargetApi api) {
7687
exists(
7788
ThroughFlowConfig config, DataFlow::ParameterNode p, ReturnNodeExt returnNodeExt, string input,

0 commit comments

Comments
 (0)