File tree Expand file tree Collapse file tree 4 files changed +32
-3
lines changed
src/utils/model-generator
test/utils/model-generator Expand file tree Collapse file tree 4 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ class PropagateToSinkConfiguration extends TaintTracking::Configuration {
16
16
PropagateToSinkConfiguration ( ) { this = "parameters or flowing into sinks" }
17
17
18
18
override predicate isSource ( DataFlow:: Node source ) {
19
- ( source .asExpr ( ) instanceof FieldAccess or source instanceof DataFlow:: ParameterNode ) and
19
+ ( source .asExpr ( ) . ( FieldAccess ) . isOwnFieldAccess ( ) or source instanceof DataFlow:: ParameterNode ) and
20
20
source .getEnclosingCallable ( ) .isPublic ( ) and
21
21
exists ( RefType t |
22
22
t = source .getEnclosingCallable ( ) .getDeclaringType ( ) .getAnAncestor ( ) and
Original file line number Diff line number Diff line change @@ -190,8 +190,7 @@ class ParameterToReturnValueTaintConfig extends TaintTracking::Configuration {
190
190
override predicate isSink ( DataFlow:: Node sink ) { sink instanceof ReturnNodeExt }
191
191
192
192
override predicate isAdditionalTaintStep ( DataFlow:: Node node1 , DataFlow:: Node node2 ) {
193
- node2 .asExpr ( ) .( ConstructorCall ) .getAnArgument ( ) = node1 .asExpr ( ) and
194
- node1 .asExpr ( ) .( Argument ) .getCall ( ) .getCallee ( ) .fromSource ( )
193
+ node2 .asExpr ( ) .( ConstructorCall ) .getAnArgument ( ) = node1 .asExpr ( )
195
194
}
196
195
}
197
196
@@ -261,6 +260,7 @@ predicate isRelevantType(Type t) {
261
260
not t instanceof PrimitiveType and
262
261
not t instanceof BoxedType and
263
262
not t .( RefType ) .getAnAncestor ( ) .hasQualifiedName ( "java.lang" , "Number" ) and
263
+ not t .( RefType ) .getAnAncestor ( ) .hasQualifiedName ( "java.nio.charset" , "Charset" ) and
264
264
(
265
265
not t .( Array ) .getElementType ( ) instanceof PrimitiveType or
266
266
isPrimitiveTypeUsedForBulkData ( t .( Array ) .getElementType ( ) )
Original file line number Diff line number Diff line change 44
44
| p;Pojo;false;getValue;();;Argument[-1];ReturnValue;taint |
45
45
| p;Pojo;false;setValue;(String);;Argument[0];Argument[-1];taint |
46
46
| p;PrivateFlowViaPublicInterface;true;createAnSPI;(File);;Argument[0];ReturnValue;taint |
47
+ | p;PrivateFlowViaPublicInterface;true;createAnSPIWithoutTrackingFile;(File);;Argument[0];ReturnValue;taint |
Original file line number Diff line number Diff line change 7
7
8
8
public class PrivateFlowViaPublicInterface {
9
9
10
+ static class RandomPojo {
11
+ public File someFile = new File ("someFile" );
12
+ }
10
13
public static interface SPI {
11
14
OutputStream openStream () throws IOException ;
15
+
16
+ default OutputStream openStreamNone () throws IOException {
17
+ return null ;
18
+ };
12
19
}
13
20
14
21
private static final class PrivateImplWithSink implements SPI {
@@ -25,9 +32,30 @@ public OutputStream openStream() throws IOException {
25
32
}
26
33
27
34
}
35
+
36
+ private static final class PrivateImplWithRandomField implements SPI {
37
+
38
+ public PrivateImplWithRandomField (File file ) {
39
+ }
40
+
41
+ @ Override
42
+ public OutputStream openStream () throws IOException {
43
+ return null ;
44
+ }
45
+
46
+ @ Override
47
+ public OutputStream openStreamNone () throws IOException {
48
+ return new FileOutputStream (new RandomPojo ().someFile );
49
+ }
50
+
51
+ }
28
52
29
53
public static SPI createAnSPI (File file ) {
30
54
return new PrivateImplWithSink (file );
31
55
}
56
+
57
+ public static SPI createAnSPIWithoutTrackingFile (File file ) {
58
+ return new PrivateImplWithRandomField (file );
59
+ }
32
60
33
61
}
You can’t perform that action at this time.
0 commit comments