Skip to content

Commit 12ff2c6

Browse files
committed
C#/Java: Improve comments in CaptureSummaryModels.
1 parent 3ad9731 commit 12ff2c6

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

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

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ private import CaptureSummaryModels
99
/**
1010
* Capture fluent APIs that return `this`.
1111
* Example of a fluent API:
12-
* ```
12+
* ```csharp
1313
* public class BasicFlow {
1414
* public BasicFlow ReturnThis(object input)
1515
* {
@@ -18,16 +18,14 @@ private import CaptureSummaryModels
1818
* }
1919
* ```
2020
* Captured Model:
21-
* ```
22-
* Summaries;BasicFlow;false;ReturnThis;(System.Object);Argument[Qualifier];ReturnValue;value
23-
* ```
21+
* ```Summaries;BasicFlow;false;ReturnThis;(System.Object);Argument[Qualifier];ReturnValue;value```
2422
* Capture APIs that transfer taint from an input parameter to an output return
2523
* value or parameter.
2624
* Allows a sequence of read steps followed by a sequence of store steps.
2725
*
2826
* Examples:
2927
*
30-
* ```
28+
* ```csharp
3129
* public class BasicFlow {
3230
* private string tainted;
3331
*
@@ -48,7 +46,7 @@ private import CaptureSummaryModels
4846
* Summaries;BasicFlow;false;AssignFieldToArray;(System.Object[]);Argument[Qualifier];Argument[0].Element;taint
4947
* ```
5048
*
51-
* ```
49+
* ```csharp
5250
* public class BasicFlow {
5351
* private string tainted;
5452
*
@@ -59,9 +57,9 @@ private import CaptureSummaryModels
5957
* }
6058
* ```
6159
* Captured Model:
62-
* `Summaries;BasicFlow;false;SetField;(System.String);Argument[0];Argument[Qualifier];taint`
60+
* ```Summaries;BasicFlow;false;SetField;(System.String);Argument[0];Argument[Qualifier];taint```
6361
*
64-
* ```
62+
* ```csharp
6563
* public class BasicFlow {
6664
* public void ReturnSubstring(string s)
6765
* {
@@ -70,9 +68,9 @@ private import CaptureSummaryModels
7068
* }
7169
* ```
7270
* Captured Model:
73-
* `Summaries;BasicFlow;false;ReturnSubstring;(System.String);Argument[0];ReturnValue;taint`
71+
* ```Summaries;BasicFlow;false;ReturnSubstring;(System.String);Argument[0];ReturnValue;taint```
7472
*
75-
* ```
73+
* ```csharp
7674
* public class BasicFlow {
7775
* public void AssignToArray(int data, int[] target)
7876
* {
@@ -81,7 +79,7 @@ private import CaptureSummaryModels
8179
* }
8280
* ```
8381
* Captured Model:
84-
* `Summaries;BasicFlow;false;AssignToArray;(System.Int32,System.Int32[]);Argument[0];Argument[1].Element;taint`
82+
* ```Summaries;BasicFlow;false;AssignToArray;(System.Int32,System.Int32[]);Argument[0];Argument[1].Element;taint```
8583
*/
8684
private string captureFlow(TargetAPI api) {
8785
result = captureQualifierFlow(api) or

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ private import CaptureSummaryModels
99
/**
1010
* Capture fluent APIs that return `this`.
1111
* Example of a fluent API:
12-
* ```
12+
* ```java
1313
* public class Foo {
1414
* public Foo someAPI() {
1515
* // some side-effect
@@ -24,7 +24,7 @@ private import CaptureSummaryModels
2424
*
2525
* Examples:
2626
*
27-
* ```
27+
* ```java
2828
* public class Foo {
2929
* private String tainted;
3030
*
@@ -37,41 +37,41 @@ private import CaptureSummaryModels
3737
* }
3838
* }
3939
* ```
40-
* Captured Model:
40+
* Captured Models:
4141
* ```
4242
* p;Foo;true;returnsTainted;;Argument[-1];ReturnValue;taint
4343
* p;Foo;true;putsTaintIntoParameter;(List);Argument[-1];Argument[0];taint
4444
* ```
4545
*
46-
* ```
46+
* ```java
4747
* public class Foo {
4848
* private String tainted;
4949
* public void doSomething(String input) {
5050
* tainted = input;
5151
* }
5252
* ```
5353
* Captured Model:
54-
* `p;Foo;true;doSomething;(String);Argument[0];Argument[-1];taint`
54+
* ```p;Foo;true;doSomething;(String);Argument[0];Argument[-1];taint```
5555
*
56-
* ```
56+
* ```java
5757
* public class Foo {
5858
* public String returnData(String tainted) {
5959
* return tainted.substring(0,10)
6060
* }
6161
* }
6262
* ```
6363
* Captured Model:
64-
* `p;Foo;true;returnData;;Argument[0];ReturnValue;taint`
64+
* ```p;Foo;true;returnData;;Argument[0];ReturnValue;taint```
6565
*
66-
* ```
66+
* ```java
6767
* public class Foo {
6868
* public void addToList(String tainted, List<String> foo) {
6969
* foo.add(tainted);
7070
* }
7171
* }
7272
* ```
7373
* Captured Model:
74-
* `p;Foo;true;addToList;;Argument[0];Argument[1];taint`
74+
* ```p;Foo;true;addToList;;Argument[0];Argument[1];taint```
7575
*/
7676
string captureFlow(TargetAPI api) {
7777
result = captureQualifierFlow(api) or

0 commit comments

Comments
 (0)