@@ -165,7 +165,7 @@ private predicate summaryModel(string row) { any(SummaryModelCsv s).row(row) }
165
165
/** Holds if a source model exists for the given parameters. */
166
166
predicate sourceModel (
167
167
string namespace , string type , boolean subtypes , string name , string signature , string ext ,
168
- string output , string kind
168
+ string output , string kind , boolean generated
169
169
) {
170
170
exists ( string row |
171
171
sourceModel ( row ) and
@@ -177,14 +177,15 @@ predicate sourceModel(
177
177
row .splitAt ( ";" , 4 ) = signature and
178
178
row .splitAt ( ";" , 5 ) = ext and
179
179
row .splitAt ( ";" , 6 ) = output and
180
- row .splitAt ( ";" , 7 ) = kind
180
+ row .splitAt ( ";" , 7 ) = kind and
181
+ generated = false
181
182
)
182
183
}
183
184
184
185
/** Holds if a sink model exists for the given parameters. */
185
186
predicate sinkModel (
186
187
string namespace , string type , boolean subtypes , string name , string signature , string ext ,
187
- string input , string kind
188
+ string input , string kind , boolean generated
188
189
) {
189
190
exists ( string row |
190
191
sinkModel ( row ) and
@@ -196,14 +197,15 @@ predicate sinkModel(
196
197
row .splitAt ( ";" , 4 ) = signature and
197
198
row .splitAt ( ";" , 5 ) = ext and
198
199
row .splitAt ( ";" , 6 ) = input and
199
- row .splitAt ( ";" , 7 ) = kind
200
+ row .splitAt ( ";" , 7 ) = kind and
201
+ generated = false
200
202
)
201
203
}
202
204
203
205
/** Holds if a summary model exists for the given parameters. */
204
206
predicate summaryModel (
205
207
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
207
209
) {
208
210
exists ( string row |
209
211
summaryModel ( row ) and
@@ -216,14 +218,15 @@ predicate summaryModel(
216
218
row .splitAt ( ";" , 5 ) = ext and
217
219
row .splitAt ( ";" , 6 ) = input and
218
220
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 ":".
220
223
)
221
224
}
222
225
223
226
private 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 , _, _, _, _, _, _, _, _, _ )
227
230
}
228
231
229
232
private predicate namespaceLink ( string shortns , string longns ) {
@@ -251,25 +254,25 @@ predicate modelCoverage(string namespace, int namespaces, string kind, string pa
251
254
part = "source" and
252
255
n =
253
256
strictcount ( string subns , string type , boolean subtypes , string name , string signature ,
254
- string ext , string output |
257
+ string ext , string output , boolean generated |
255
258
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 )
257
260
)
258
261
or
259
262
part = "sink" and
260
263
n =
261
264
strictcount ( string subns , string type , boolean subtypes , string name , string signature ,
262
- string ext , string input |
265
+ string ext , string input , boolean generated |
263
266
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 )
265
268
)
266
269
or
267
270
part = "summary" and
268
271
n =
269
272
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 |
271
274
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 )
273
276
)
274
277
)
275
278
}
@@ -279,11 +282,11 @@ module CsvValidation {
279
282
/** Holds if some row in a CSV-based flow model appears to contain typos. */
280
283
query predicate invalidModelRow ( string msg ) {
281
284
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"
283
286
or
284
- sinkModel ( namespace , type , _, name , signature , ext , _, _) and pred = "sink"
287
+ sinkModel ( namespace , type , _, name , signature , ext , _, _, _ ) and pred = "sink"
285
288
or
286
- summaryModel ( namespace , type , _, name , signature , ext , _, _, _) and pred = "summary"
289
+ summaryModel ( namespace , type , _, name , signature , ext , _, _, _, _ ) and pred = "summary"
287
290
|
288
291
not namespace .regexpMatch ( "[a-zA-Z0-9_\\.]+" ) and
289
292
msg = "Dubious namespace \"" + namespace + "\" in " + pred + " model."
@@ -302,9 +305,9 @@ module CsvValidation {
302
305
)
303
306
or
304
307
exists ( string pred , AccessPath input , string part |
305
- sinkModel ( _, _, _, _, _, _, input , _) and pred = "sink"
308
+ sinkModel ( _, _, _, _, _, _, input , _, _ ) and pred = "sink"
306
309
or
307
- summaryModel ( _, _, _, _, _, _, input , _, _) and pred = "summary"
310
+ summaryModel ( _, _, _, _, _, _, input , _, _, _ ) and pred = "summary"
308
311
|
309
312
(
310
313
invalidSpecComponent ( input , part ) and
@@ -319,9 +322,9 @@ module CsvValidation {
319
322
)
320
323
or
321
324
exists ( string pred , string output , string part |
322
- sourceModel ( _, _, _, _, _, _, output , _) and pred = "source"
325
+ sourceModel ( _, _, _, _, _, _, output , _, _ ) and pred = "source"
323
326
or
324
- summaryModel ( _, _, _, _, _, _, _, output , _) and pred = "summary"
327
+ summaryModel ( _, _, _, _, _, _, _, output , _, _ ) and pred = "summary"
325
328
|
326
329
invalidSpecComponent ( output , part ) and
327
330
not part = "" and
@@ -353,7 +356,7 @@ module CsvValidation {
353
356
or
354
357
exists ( string row , string kind | summaryModel ( row ) |
355
358
kind = row .splitAt ( ";" , 8 ) and
356
- not kind = [ "taint" , "value" ] and
359
+ not kind = [ "taint" , "value" , "generated:taint" , "generated:value" ] and
357
360
msg = "Invalid kind \"" + kind + "\" in summary model."
358
361
)
359
362
or
@@ -374,9 +377,9 @@ module CsvValidation {
374
377
private predicate elementSpec (
375
378
string namespace , string type , boolean subtypes , string name , string signature , string ext
376
379
) {
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 , _, _, _, _ )
380
383
}
381
384
382
385
private predicate elementSpec (
0 commit comments