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 {
1616 PropagateToSinkConfiguration ( ) { this = "parameters or flowing into sinks" }
1717
1818 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
2020 source .getEnclosingCallable ( ) .isPublic ( ) and
2121 exists ( RefType t |
2222 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 {
190190 override predicate isSink ( DataFlow:: Node sink ) { sink instanceof ReturnNodeExt }
191191
192192 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 ( )
195194 }
196195}
197196
@@ -261,6 +260,7 @@ predicate isRelevantType(Type t) {
261260 not t instanceof PrimitiveType and
262261 not t instanceof BoxedType and
263262 not t .( RefType ) .getAnAncestor ( ) .hasQualifiedName ( "java.lang" , "Number" ) and
263+ not t .( RefType ) .getAnAncestor ( ) .hasQualifiedName ( "java.nio.charset" , "Charset" ) and
264264 (
265265 not t .( Array ) .getElementType ( ) instanceof PrimitiveType or
266266 isPrimitiveTypeUsedForBulkData ( t .( Array ) .getElementType ( ) )
Original file line number Diff line number Diff line change 4444| p;Pojo;false;getValue;();;Argument[-1];ReturnValue;taint |
4545| p;Pojo;false;setValue;(String);;Argument[0];Argument[-1];taint |
4646| 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 77
88public class PrivateFlowViaPublicInterface {
99
10+ static class RandomPojo {
11+ public File someFile = new File ("someFile" );
12+ }
1013 public static interface SPI {
1114 OutputStream openStream () throws IOException ;
15+
16+ default OutputStream openStreamNone () throws IOException {
17+ return null ;
18+ };
1219 }
1320
1421 private static final class PrivateImplWithSink implements SPI {
@@ -25,9 +32,30 @@ public OutputStream openStream() throws IOException {
2532 }
2633
2734 }
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+ }
2852
2953 public static SPI createAnSPI (File file ) {
3054 return new PrivateImplWithSink (file );
3155 }
56+
57+ public static SPI createAnSPIWithoutTrackingFile (File file ) {
58+ return new PrivateImplWithRandomField (file );
59+ }
3260
3361}
You can’t perform that action at this time.
0 commit comments