Skip to content

Commit c9832df

Browse files
committed
C#/Java: Add test for missing neutral summary generation.
1 parent bf69c76 commit c9832df

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

csharp/ql/test/utils/modelgenerator/dataflow/CaptureNeutralModels.ext.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ extensions:
44
extensible: neutralModel
55
data:
66
- [ "Models", "ManuallyModelled", "HasNeutralSummaryNoFlow", "(System.Object)", "summary", "manual"]
7+
- [ "Sinks", "NewSinks", "NoSink", "(System.Object)", "summary", "df-generated"]
8+
- [ "Sinks", "NewSinks", "NoSink", "(System.Object)", "sink", "manual"]

csharp/ql/test/utils/modelgenerator/dataflow/Sinks.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ public class NewSinks
2020
// neutral=Sinks;NewSinks;Sink2;(System.Object);summary;df-generated
2121
public static void Sink2(object o) => throw null;
2222

23+
// Defined as sink neutral in the file next to the neutral summary test.
24+
// MISSING NEUTRAL
25+
public static void NoSink(object o) => throw null;
26+
2327
// New sink
2428
// sink=Sinks;NewSinks;false;WrapResponseWrite;(System.Object);;Argument[0];html-injection;df-generated
2529
// neutral=Sinks;NewSinks;WrapResponseWrite;(System.Object);summary;df-generated
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
extensions:
2+
- addsTo:
3+
pack: codeql/java-all
4+
extensible: neutralModel
5+
data:
6+
- [ "p", "Sinks", "nosink", "(Object)", "sink", "manual"]
7+
- [ "p", "Sinks", "nosink", "(Object)", "summary", "df-generated"]

java/ql/test/utils/modelgenerator/dataflow/p/Sinks.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ public void sink(Object o) {}
2121
// neutral=p;Sinks;sink2;(Object);summary;df-generated
2222
public void sink2(Object o) {}
2323

24+
// Defined as sink neutral file in the model file next to the
25+
// neutral test.
26+
// MISSING NEUTRAL.
27+
public void nosink(Object o) {}
28+
2429
// sink=p;Sinks;true;copyFileToDirectory;(Path,Path,CopyOption[]);;Argument[0];path-injection;df-generated
2530
// sink=p;Sinks;true;copyFileToDirectory;(Path,Path,CopyOption[]);;Argument[1];path-injection;df-generated
2631
// neutral=p;Sinks;copyFileToDirectory;(Path,Path,CopyOption[]);summary;df-generated

0 commit comments

Comments
 (0)