Skip to content

Commit 7be7929

Browse files
committed
C#: Define extensible predicates.
1 parent eb27e8a commit 7be7929

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/ExternalFlow.qll

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,14 @@ private predicate negativeSummaryModelInternal(string row) {
189189
any(NegativeSummaryModelCsv s).row(row)
190190
}
191191

192+
/**
193+
* Holds if a source model exists for the given parameters.
194+
*/
195+
extensible predicate extSourceModel(
196+
string namespace, string type, boolean subtypes, string name, string signature, string ext,
197+
string output, string kind, string provenance
198+
);
199+
192200
/** Holds if a source model exists for the given parameters. */
193201
predicate sourceModel(
194202
string namespace, string type, boolean subtypes, string name, string signature, string ext,
@@ -207,6 +215,8 @@ predicate sourceModel(
207215
row.splitAt(";", 7) = kind and
208216
row.splitAt(";", 8) = provenance
209217
)
218+
or
219+
extSourceModel(namespace, type, subtypes, name, signature, ext, output, kind, provenance)
210220
}
211221

212222
/** Holds if `row` is a source model. */
@@ -229,6 +239,12 @@ predicate sourceModel(string row) {
229239
)
230240
}
231241

242+
/** Holds if a sink model exists for the given parameters. */
243+
extensible predicate extSinkModel(
244+
string namespace, string type, boolean subtypes, string name, string signature, string ext,
245+
string input, string kind, string provenance
246+
);
247+
232248
/** Holds if a sink model exists for the given parameters. */
233249
predicate sinkModel(
234250
string namespace, string type, boolean subtypes, string name, string signature, string ext,
@@ -247,6 +263,8 @@ predicate sinkModel(
247263
row.splitAt(";", 7) = kind and
248264
row.splitAt(";", 8) = provenance
249265
)
266+
or
267+
extSinkModel(namespace, type, subtypes, name, signature, ext, input, kind, provenance)
250268
}
251269

252270
/** Holds if `row` is a sink model. */
@@ -269,6 +287,12 @@ predicate sinkModel(string row) {
269287
)
270288
}
271289

290+
/** Holds if a summary model exists for the given parameters. */
291+
extensible predicate extSummaryModel(
292+
string namespace, string type, boolean subtypes, string name, string signature, string ext,
293+
string input, string output, string kind, string provenance
294+
);
295+
272296
/** Holds if a summary model exists for the given parameters. */
273297
predicate summaryModel(
274298
string namespace, string type, boolean subtypes, string name, string signature, string ext,
@@ -288,6 +312,8 @@ predicate summaryModel(
288312
row.splitAt(";", 8) = kind and
289313
row.splitAt(";", 9) = provenance
290314
)
315+
or
316+
extSummaryModel(namespace, type, subtypes, name, signature, ext, input, output, kind, provenance)
291317
}
292318

293319
/** Holds if `row` is a summary model. */
@@ -311,6 +337,11 @@ predicate summaryModel(string row) {
311337
)
312338
}
313339

340+
/** Holds if a summary model exists indicating there is no flow for the given parameters. */
341+
extensible predicate extNegativeSummaryModel(
342+
string namespace, string type, string name, string signature, string provenance
343+
);
344+
314345
/** Holds if a summary model exists indicating there is no flow for the given parameters. */
315346
predicate negativeSummaryModel(
316347
string namespace, string type, string name, string signature, string provenance
@@ -323,6 +354,8 @@ predicate negativeSummaryModel(
323354
row.splitAt(";", 3) = signature and
324355
row.splitAt(";", 4) = provenance
325356
)
357+
or
358+
extNegativeSummaryModel(namespace, type, name, signature, provenance)
326359
}
327360

328361
/** Holds if `row` is a negative summary model. */

0 commit comments

Comments
 (0)