File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
csharp/ql/src/utils/model-generator Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 11import csharp
22private import semmle.code.csharp.commons.Util
3+ private import semmle.code.csharp.dataflow.internal.DataFlowPrivate
34
45private predicate isRelevantForModels ( Callable api ) { not api instanceof MainMethod }
56
@@ -49,3 +50,24 @@ string asPartialModel(TargetAPI api) {
4950 + /* ext + */ ";" //
5051 )
5152}
53+
54+ predicate isRelevantType ( Type t ) { not t instanceof Enum }
55+
56+ predicate isRelevantTaintStep ( DataFlow:: Node node1 , DataFlow:: Node node2 ) {
57+ exists ( DataFlow:: Content f |
58+ readStep ( node1 , f , node2 ) and
59+ if f instanceof DataFlow:: FieldContent
60+ then isRelevantType ( f .( DataFlow:: FieldContent ) .getField ( ) .getType ( ) )
61+ else
62+ if f instanceof DataFlow:: SyntheticFieldContent
63+ then isRelevantType ( f .( DataFlow:: SyntheticFieldContent ) .getField ( ) .getType ( ) )
64+ else any ( )
65+ )
66+ or
67+ exists ( DataFlow:: Content f | storeStep ( node1 , f , node2 ) | f instanceof DataFlow:: ElementContent )
68+ }
69+
70+ predicate isRelevantContent ( DataFlow:: Content f ) {
71+ isRelevantType ( f .( DataFlow:: FieldContent ) .getField ( ) .getType ( ) ) or
72+ f instanceof DataFlow:: ElementContent
73+ }
You can’t perform that action at this time.
0 commit comments