@@ -165,7 +165,7 @@ private predicate summaryModel(string row) { any(SummaryModelCsv s).row(row) }
165165/** Holds if a source model exists for the given parameters. */
166166predicate sourceModel (
167167 string namespace , string type , boolean subtypes , string name , string signature , string ext ,
168- string output , string kind
168+ string output , string kind , boolean generated
169169) {
170170 exists ( string row |
171171 sourceModel ( row ) and
@@ -177,14 +177,15 @@ predicate sourceModel(
177177 row .splitAt ( ";" , 4 ) = signature and
178178 row .splitAt ( ";" , 5 ) = ext and
179179 row .splitAt ( ";" , 6 ) = output and
180- row .splitAt ( ";" , 7 ) = kind
180+ row .splitAt ( ";" , 7 ) = kind and
181+ generated = false
181182 )
182183}
183184
184185/** Holds if a sink model exists for the given parameters. */
185186predicate sinkModel (
186187 string namespace , string type , boolean subtypes , string name , string signature , string ext ,
187- string input , string kind
188+ string input , string kind , boolean generated
188189) {
189190 exists ( string row |
190191 sinkModel ( row ) and
@@ -196,14 +197,15 @@ predicate sinkModel(
196197 row .splitAt ( ";" , 4 ) = signature and
197198 row .splitAt ( ";" , 5 ) = ext and
198199 row .splitAt ( ";" , 6 ) = input and
199- row .splitAt ( ";" , 7 ) = kind
200+ row .splitAt ( ";" , 7 ) = kind and
201+ generated = false
200202 )
201203}
202204
203205/** Holds if a summary model exists for the given parameters. */
204206predicate summaryModel (
205207 string namespace , string type , boolean subtypes , string name , string signature , string ext ,
206- string input , string output , string kind
208+ string input , string output , string kind , boolean generated
207209) {
208210 exists ( string row |
209211 summaryModel ( row ) and
@@ -216,14 +218,15 @@ predicate summaryModel(
216218 row .splitAt ( ";" , 5 ) = ext and
217219 row .splitAt ( ";" , 6 ) = input and
218220 row .splitAt ( ";" , 7 ) = output and
219- row .splitAt ( ";" , 8 ) = kind
221+ row .splitAt ( ";" , 8 ) = kind and
222+ generated = false // We need to split the "kind" field on ":".
220223 )
221224}
222225
223226private predicate relevantNamespace ( string namespace ) {
224- sourceModel ( namespace , _, _, _, _, _, _, _) or
225- sinkModel ( namespace , _, _, _, _, _, _, _) or
226- summaryModel ( namespace , _, _, _, _, _, _, _, _)
227+ sourceModel ( namespace , _, _, _, _, _, _, _, _ ) or
228+ sinkModel ( namespace , _, _, _, _, _, _, _, _ ) or
229+ summaryModel ( namespace , _, _, _, _, _, _, _, _, _ )
227230}
228231
229232private predicate namespaceLink ( string shortns , string longns ) {
@@ -251,25 +254,25 @@ predicate modelCoverage(string namespace, int namespaces, string kind, string pa
251254 part = "source" and
252255 n =
253256 strictcount ( string subns , string type , boolean subtypes , string name , string signature ,
254- string ext , string output |
257+ string ext , string output , boolean generated |
255258 canonicalNamespaceLink ( namespace , subns ) and
256- sourceModel ( subns , type , subtypes , name , signature , ext , output , kind )
259+ sourceModel ( subns , type , subtypes , name , signature , ext , output , kind , generated )
257260 )
258261 or
259262 part = "sink" and
260263 n =
261264 strictcount ( string subns , string type , boolean subtypes , string name , string signature ,
262- string ext , string input |
265+ string ext , string input , boolean generated |
263266 canonicalNamespaceLink ( namespace , subns ) and
264- sinkModel ( subns , type , subtypes , name , signature , ext , input , kind )
267+ sinkModel ( subns , type , subtypes , name , signature , ext , input , kind , generated )
265268 )
266269 or
267270 part = "summary" and
268271 n =
269272 strictcount ( string subns , string type , boolean subtypes , string name , string signature ,
270- string ext , string input , string output |
273+ string ext , string input , string output , boolean generated |
271274 canonicalNamespaceLink ( namespace , subns ) and
272- summaryModel ( subns , type , subtypes , name , signature , ext , input , output , kind )
275+ summaryModel ( subns , type , subtypes , name , signature , ext , input , output , kind , generated )
273276 )
274277 )
275278}
@@ -279,11 +282,11 @@ module CsvValidation {
279282 /** Holds if some row in a CSV-based flow model appears to contain typos. */
280283 query predicate invalidModelRow ( string msg ) {
281284 exists ( string pred , string namespace , string type , string name , string signature , string ext |
282- sourceModel ( namespace , type , _, name , signature , ext , _, _) and pred = "source"
285+ sourceModel ( namespace , type , _, name , signature , ext , _, _, _ ) and pred = "source"
283286 or
284- sinkModel ( namespace , type , _, name , signature , ext , _, _) and pred = "sink"
287+ sinkModel ( namespace , type , _, name , signature , ext , _, _, _ ) and pred = "sink"
285288 or
286- summaryModel ( namespace , type , _, name , signature , ext , _, _, _) and pred = "summary"
289+ summaryModel ( namespace , type , _, name , signature , ext , _, _, _, _ ) and pred = "summary"
287290 |
288291 not namespace .regexpMatch ( "[a-zA-Z0-9_\\.]+" ) and
289292 msg = "Dubious namespace \"" + namespace + "\" in " + pred + " model."
@@ -302,9 +305,9 @@ module CsvValidation {
302305 )
303306 or
304307 exists ( string pred , AccessPath input , string part |
305- sinkModel ( _, _, _, _, _, _, input , _) and pred = "sink"
308+ sinkModel ( _, _, _, _, _, _, input , _, _ ) and pred = "sink"
306309 or
307- summaryModel ( _, _, _, _, _, _, input , _, _) and pred = "summary"
310+ summaryModel ( _, _, _, _, _, _, input , _, _, _ ) and pred = "summary"
308311 |
309312 (
310313 invalidSpecComponent ( input , part ) and
@@ -319,9 +322,9 @@ module CsvValidation {
319322 )
320323 or
321324 exists ( string pred , string output , string part |
322- sourceModel ( _, _, _, _, _, _, output , _) and pred = "source"
325+ sourceModel ( _, _, _, _, _, _, output , _, _ ) and pred = "source"
323326 or
324- summaryModel ( _, _, _, _, _, _, _, output , _) and pred = "summary"
327+ summaryModel ( _, _, _, _, _, _, _, output , _, _ ) and pred = "summary"
325328 |
326329 invalidSpecComponent ( output , part ) and
327330 not part = "" and
@@ -353,7 +356,7 @@ module CsvValidation {
353356 or
354357 exists ( string row , string kind | summaryModel ( row ) |
355358 kind = row .splitAt ( ";" , 8 ) and
356- not kind = [ "taint" , "value" ] and
359+ not kind = [ "taint" , "value" , "generated:taint" , "generated:value" ] and
357360 msg = "Invalid kind \"" + kind + "\" in summary model."
358361 )
359362 or
@@ -374,9 +377,9 @@ module CsvValidation {
374377private predicate elementSpec (
375378 string namespace , string type , boolean subtypes , string name , string signature , string ext
376379) {
377- sourceModel ( namespace , type , subtypes , name , signature , ext , _, _) or
378- sinkModel ( namespace , type , subtypes , name , signature , ext , _, _) or
379- summaryModel ( namespace , type , subtypes , name , signature , ext , _, _, _)
380+ sourceModel ( namespace , type , subtypes , name , signature , ext , _, _, _ ) or
381+ sinkModel ( namespace , type , subtypes , name , signature , ext , _, _, _ ) or
382+ summaryModel ( namespace , type , subtypes , name , signature , ext , _, _, _, _ )
380383}
381384
382385private predicate elementSpec (
0 commit comments