@@ -240,6 +240,16 @@ module Public {
240
240
*/
241
241
predicate isAutoGenerated ( ) { none ( ) }
242
242
}
243
+
244
+ /** A callable with a flow summary stating there is no flow via the callable. */
245
+ class NegativeSummarizedCallable extends SummarizedCallableBase {
246
+ NegativeSummarizedCallable ( ) { negativeSummaryElement ( this , _) }
247
+
248
+ /**
249
+ * Holds if the negative summary is auto generated.
250
+ */
251
+ predicate isAutoGenerated ( ) { negativeSummaryElement ( this , true ) }
252
+ }
243
253
}
244
254
245
255
/**
@@ -1094,7 +1104,7 @@ module Private {
1094
1104
1095
1105
/** Provides a query predicate for outputting a set of relevant flow summaries. */
1096
1106
module TestOutput {
1097
- /** A flow summary to include in the `summary/3 ` query predicate. */
1107
+ /** A flow summary to include in the `summary/1 ` query predicate. */
1098
1108
abstract class RelevantSummarizedCallable instanceof SummarizedCallable {
1099
1109
/** Gets the string representation of this callable used by `summary/1`. */
1100
1110
abstract string getCallableCsv ( ) ;
@@ -1109,15 +1119,27 @@ module Private {
1109
1119
string toString ( ) { result = super .toString ( ) }
1110
1120
}
1111
1121
1122
+ /** A flow summary to include in the `negativeSummary/1` query predicate. */
1123
+ abstract class RelevantNegativeSummarizedCallable instanceof NegativeSummarizedCallable {
1124
+ /** Gets the string representation of this callable used by `summary/1`. */
1125
+ abstract string getCallableCsv ( ) ;
1126
+
1127
+ string toString ( ) { result = super .toString ( ) }
1128
+ }
1129
+
1112
1130
/** Render the kind in the format used in flow summaries. */
1113
1131
private string renderKind ( boolean preservesValue ) {
1114
1132
preservesValue = true and result = "value"
1115
1133
or
1116
1134
preservesValue = false and result = "taint"
1117
1135
}
1118
1136
1119
- private string renderProvenance ( RelevantSummarizedCallable c ) {
1120
- if c .( SummarizedCallable ) .isAutoGenerated ( ) then result = "generated" else result = "manual"
1137
+ private string renderProvenance ( SummarizedCallable c ) {
1138
+ if c .isAutoGenerated ( ) then result = "generated" else result = "manual"
1139
+ }
1140
+
1141
+ private string renderProvenanceNegative ( NegativeSummarizedCallable c ) {
1142
+ if c .isAutoGenerated ( ) then result = "generated" else result = "manual"
1121
1143
}
1122
1144
1123
1145
/**
@@ -1132,8 +1154,23 @@ module Private {
1132
1154
|
1133
1155
c .relevantSummary ( input , output , preservesValue ) and
1134
1156
csv =
1135
- c .getCallableCsv ( ) + getComponentStackCsv ( input ) + ";" + getComponentStackCsv ( output ) +
1136
- ";" + renderKind ( preservesValue ) + ";" + renderProvenance ( c )
1157
+ c .getCallableCsv ( ) // Callable information
1158
+ + getComponentStackCsv ( input ) + ";" // input
1159
+ + getComponentStackCsv ( output ) + ";" // output
1160
+ + renderKind ( preservesValue ) + ";" // kind
1161
+ + renderProvenance ( c ) // provenance
1162
+ )
1163
+ }
1164
+
1165
+ /**
1166
+ * Holds if a negative flow summary `csv` exists (semi-colon separated format). Used for testing purposes.
1167
+ * The syntax is: "namespace;type;name;signature;provenance"",
1168
+ */
1169
+ query predicate negativeSummary ( string csv ) {
1170
+ exists ( RelevantNegativeSummarizedCallable c |
1171
+ csv =
1172
+ c .getCallableCsv ( ) // Callable information
1173
+ + renderProvenanceNegative ( c ) // provenance
1137
1174
)
1138
1175
}
1139
1176
}
0 commit comments