Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 38c6bf5

Browse files
committed
C#: Make CSV model validation of the provenance column.
1 parent 5e3bb82 commit 38c6bf5

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,16 @@ predicate modelCoverage(string namespace, int namespaces, string kind, string pa
288288
module CsvValidation {
289289
/** Holds if some row in a CSV-based flow model appears to contain typos. */
290290
query predicate invalidModelRow(string msg) {
291-
exists(string pred, string namespace, string type, string name, string signature, string ext |
292-
sourceModel(namespace, type, _, name, signature, ext, _, _, _) and pred = "source"
291+
exists(
292+
string pred, string namespace, string type, string name, string signature, string ext,
293+
string provenance
294+
|
295+
sourceModel(namespace, type, _, name, signature, ext, _, _, provenance) and pred = "source"
293296
or
294-
sinkModel(namespace, type, _, name, signature, ext, _, _, _) and pred = "sink"
297+
sinkModel(namespace, type, _, name, signature, ext, _, _, provenance) and pred = "sink"
295298
or
296-
summaryModel(namespace, type, _, name, signature, ext, _, _, _, _) and pred = "summary"
299+
summaryModel(namespace, type, _, name, signature, ext, _, _, _, provenance) and
300+
pred = "summary"
297301
|
298302
not namespace.regexpMatch("[a-zA-Z0-9_\\.]+") and
299303
msg = "Dubious namespace \"" + namespace + "\" in " + pred + " model."
@@ -309,6 +313,9 @@ module CsvValidation {
309313
or
310314
not ext.regexpMatch("|Attribute") and
311315
msg = "Unrecognized extra API graph element \"" + ext + "\" in " + pred + " model."
316+
or
317+
not provenance = ["manual", "generated"] and
318+
msg = "Unrecognized provenance description \"" + provenance + "\" in " + pred + " model."
312319
)
313320
or
314321
exists(string pred, AccessPath input, string part |

0 commit comments

Comments
 (0)