@@ -7,6 +7,7 @@ private import semmle.code.csharp.commons.Util as Util
77private import semmle.code.csharp.commons.Collections as Collections
88private import semmle.code.csharp.dataflow.internal.DataFlowDispatch
99private import semmle.code.csharp.frameworks.System as System
10+ private import semmle.code.csharp.frameworks.system.linq.Expressions
1011import semmle.code.csharp.dataflow.ExternalFlow as ExternalFlow
1112import semmle.code.csharp.dataflow.internal.DataFlowImplCommon as DataFlowImplCommon
1213import semmle.code.csharp.dataflow.internal.DataFlowPrivate as DataFlowPrivate
@@ -18,21 +19,11 @@ module TaintTracking = CS::TaintTracking;
1819class Type = CS:: Type ;
1920
2021/**
21- * Holds if `api` is an override or an interface implementation that
22- * is irrelevant to the data flow analysis.
22+ * Holds if any of the parameters of `api` are `System.Func<>`.
2323 */
24- private predicate isIrrelevantOverrideOrImplementation ( CS:: Callable api ) {
25- exists ( CS:: Callable exclude , CS:: Method m |
26- (
27- api = m .getAnOverrider * ( ) .getUnboundDeclaration ( )
28- or
29- api = m .getAnUltimateImplementor ( ) .getUnboundDeclaration ( )
30- ) and
31- exclude = m .getUnboundDeclaration ( )
32- |
33- exists ( System:: SystemObjectClass c | exclude = [ c .getGetHashCodeMethod ( ) , c .getEqualsMethod ( ) ] )
34- or
35- exists ( System:: SystemIEquatableTInterface i | exclude = i .getEqualsMethod ( ) )
24+ private predicate isHigherOrder ( CS:: Callable api ) {
25+ exists ( Type t | t = api .getAParameter ( ) .getType ( ) .getUnboundDeclaration ( ) |
26+ t instanceof SystemLinqExpressions:: DelegateExtType
3627 )
3728}
3829
@@ -44,7 +35,7 @@ private predicate isRelevantForModels(CS::Callable api) {
4435 api .getDeclaringType ( ) .getNamespace ( ) .getQualifiedName ( ) != "" and
4536 not api instanceof CS:: ConversionOperator and
4637 not api instanceof Util:: MainMethod and
47- not isIrrelevantOverrideOrImplementation ( api )
38+ not isHigherOrder ( api )
4839}
4940
5041/**
@@ -65,8 +56,13 @@ predicate asPartialModel = DataFlowPrivate::Csv::asPartialModel/1;
6556/**
6657 * Holds for type `t` for fields that are relevant as an intermediate
6758 * read or write step in the data flow analysis.
59+ * That is, flow through any data-flow node that does not have a relevant type
60+ * will be excluded.
6861 */
69- predicate isRelevantType ( CS:: Type t ) { not t instanceof CS:: Enum }
62+ predicate isRelevantType ( CS:: Type t ) {
63+ not t instanceof CS:: SimpleType and
64+ not t instanceof CS:: Enum
65+ }
7066
7167/**
7268 * Gets the CSV string representation of the qualifier.
0 commit comments