@@ -229,41 +229,49 @@ private predicate typeModel(string row) { any(TypeModelCsv s).row(inversePad(row
229
229
private predicate typeVariableModel ( string row ) { any ( TypeVariableModelCsv s ) .row ( inversePad ( row ) ) }
230
230
231
231
/** Holds if a source model exists for the given parameters. */
232
- predicate sourceModel ( string type , string path , string kind ) {
232
+ predicate sourceModel ( string type , string path , string kind , string model ) {
233
233
exists ( string row |
234
234
sourceModel ( row ) and
235
235
row .splitAt ( ";" , 0 ) = type and
236
236
row .splitAt ( ";" , 1 ) = path and
237
- row .splitAt ( ";" , 2 ) = kind
237
+ row .splitAt ( ";" , 2 ) = kind and
238
+ model = "SourceModelCsv"
238
239
)
239
240
or
240
- Extensions:: sourceModel ( type , path , kind )
241
+ Extensions:: sourceModel ( type , path , kind ) and
242
+ model = "" // TODO: Insert MaD provenance from sourceModel
241
243
}
242
244
243
245
/** Holds if a sink model exists for the given parameters. */
244
- private predicate sinkModel ( string type , string path , string kind ) {
246
+ private predicate sinkModel ( string type , string path , string kind , string model ) {
245
247
exists ( string row |
246
248
sinkModel ( row ) and
247
249
row .splitAt ( ";" , 0 ) = type and
248
250
row .splitAt ( ";" , 1 ) = path and
249
- row .splitAt ( ";" , 2 ) = kind
251
+ row .splitAt ( ";" , 2 ) = kind and
252
+ model = "SinkModelCsv"
250
253
)
251
254
or
252
- Extensions:: sinkModel ( type , path , kind )
255
+ Extensions:: sinkModel ( type , path , kind ) and
256
+ model = "" // TODO: Insert MaD provenance from sinkModel
253
257
}
254
258
255
259
/** Holds if a summary model `row` exists for the given parameters. */
256
- private predicate summaryModel ( string type , string path , string input , string output , string kind ) {
260
+ private predicate summaryModel (
261
+ string type , string path , string input , string output , string kind , string model
262
+ ) {
257
263
exists ( string row |
258
264
summaryModel ( row ) and
259
265
row .splitAt ( ";" , 0 ) = type and
260
266
row .splitAt ( ";" , 1 ) = path and
261
267
row .splitAt ( ";" , 2 ) = input and
262
268
row .splitAt ( ";" , 3 ) = output and
263
- row .splitAt ( ";" , 4 ) = kind
269
+ row .splitAt ( ";" , 4 ) = kind and
270
+ model = "SummaryModelCsv"
264
271
)
265
272
or
266
- Extensions:: summaryModel ( type , path , input , output , kind )
273
+ Extensions:: summaryModel ( type , path , input , output , kind ) and
274
+ model = "" // TODO: Insert MaD provenance from summaryModel
267
275
}
268
276
269
277
/** Holds if a type model exists for the given parameters. */
@@ -294,9 +302,9 @@ private predicate typeVariableModel(string name, string path) {
294
302
*/
295
303
predicate isRelevantType ( string type ) {
296
304
(
297
- sourceModel ( type , _, _) or
298
- sinkModel ( type , _, _) or
299
- summaryModel ( type , _, _, _, _) or
305
+ sourceModel ( type , _, _, _ ) or
306
+ sinkModel ( type , _, _, _ ) or
307
+ summaryModel ( type , _, _, _, _, _ ) or
300
308
typeModel ( _, type , _)
301
309
) and
302
310
(
@@ -319,9 +327,9 @@ pragma[nomagic]
319
327
predicate isRelevantFullPath ( string type , string path ) {
320
328
isRelevantType ( type ) and
321
329
(
322
- sourceModel ( type , path , _) or
323
- sinkModel ( type , path , _) or
324
- summaryModel ( type , path , _, _, _) or
330
+ sourceModel ( type , path , _, _ ) or
331
+ sinkModel ( type , path , _, _ ) or
332
+ summaryModel ( type , path , _, _, _, _ ) or
325
333
typeModel ( _, type , path )
326
334
)
327
335
}
@@ -331,8 +339,8 @@ private predicate accessPathRange(string s) {
331
339
isRelevantFullPath ( _, s )
332
340
or
333
341
exists ( string type | isRelevantType ( type ) |
334
- summaryModel ( type , _, s , _, _) or
335
- summaryModel ( type , _, _, s , _)
342
+ summaryModel ( type , _, s , _, _, _ ) or
343
+ summaryModel ( type , _, _, s , _, _ )
336
344
)
337
345
or
338
346
typeVariableModel ( _, s )
@@ -543,7 +551,7 @@ private API::Node getNodeFromPath(string type, AccessPath path) {
543
551
544
552
pragma [ nomagic]
545
553
private predicate typeStepModel ( string type , AccessPath basePath , AccessPath output ) {
546
- summaryModel ( type , basePath , "" , output , "type" )
554
+ summaryModel ( type , basePath , "" , output , "type" , _ )
547
555
}
548
556
549
557
pragma [ nomagic]
@@ -621,9 +629,9 @@ module ModelOutput {
621
629
* Holds if a CSV source model contributed `source` with the given `kind`.
622
630
*/
623
631
cached
624
- API:: Node getASourceNode ( string kind ) {
632
+ API:: Node getASourceNode ( string kind , string model ) {
625
633
exists ( string type , string path |
626
- sourceModel ( type , path , kind ) and
634
+ sourceModel ( type , path , kind , model ) and
627
635
result = getNodeFromPath ( type , path )
628
636
)
629
637
}
@@ -632,9 +640,9 @@ module ModelOutput {
632
640
* Holds if a CSV sink model contributed `sink` with the given `kind`.
633
641
*/
634
642
cached
635
- API:: Node getASinkNode ( string kind ) {
643
+ API:: Node getASinkNode ( string kind , string model ) {
636
644
exists ( string type , string path |
637
- sinkModel ( type , path , kind ) and
645
+ sinkModel ( type , path , kind , model ) and
638
646
result = getNodeFromPath ( type , path )
639
647
)
640
648
}
@@ -644,18 +652,18 @@ module ModelOutput {
644
652
*/
645
653
cached
646
654
predicate relevantSummaryModel (
647
- string type , string path , string input , string output , string kind
655
+ string type , string path , string input , string output , string kind , string model
648
656
) {
649
657
isRelevantType ( type ) and
650
- summaryModel ( type , path , input , output , kind )
658
+ summaryModel ( type , path , input , output , kind , model )
651
659
}
652
660
653
661
/**
654
662
* Holds if a `baseNode` is an invocation identified by the `type,path` part of a summary row.
655
663
*/
656
664
cached
657
665
predicate resolvedSummaryBase ( string type , string path , Specific:: InvokeNode baseNode ) {
658
- summaryModel ( type , path , _, _, _) and
666
+ summaryModel ( type , path , _, _, _, _ ) and
659
667
baseNode = getInvocationFromPath ( type , path )
660
668
}
661
669
@@ -664,7 +672,7 @@ module ModelOutput {
664
672
*/
665
673
cached
666
674
predicate resolvedSummaryRefBase ( string type , string path , API:: Node baseNode ) {
667
- summaryModel ( type , path , _, _, _) and
675
+ summaryModel ( type , path , _, _, _, _ ) and
668
676
baseNode = getNodeFromPath ( type , path )
669
677
}
670
678
@@ -680,12 +688,22 @@ module ModelOutput {
680
688
import Specific:: ModelOutputSpecific
681
689
private import codeql.mad.ModelValidation as SharedModelVal
682
690
691
+ /**
692
+ * Holds if a CSV source model contributed `source` with the given `kind`.
693
+ */
694
+ API:: Node getASourceNode ( string kind ) { result = getASourceNode ( kind , _) }
695
+
696
+ /**
697
+ * Holds if a CSV sink model contributed `sink` with the given `kind`.
698
+ */
699
+ API:: Node getASinkNode ( string kind ) { result = getASinkNode ( kind , _) }
700
+
683
701
private module KindValConfig implements SharedModelVal:: KindValidationConfigSig {
684
- predicate summaryKind ( string kind ) { summaryModel ( _, _, _, _, kind ) }
702
+ predicate summaryKind ( string kind ) { summaryModel ( _, _, _, _, kind , _ ) }
685
703
686
- predicate sinkKind ( string kind ) { sinkModel ( _, _, kind ) }
704
+ predicate sinkKind ( string kind ) { sinkModel ( _, _, kind , _ ) }
687
705
688
- predicate sourceKind ( string kind ) { sourceModel ( _, _, kind ) }
706
+ predicate sourceKind ( string kind ) { sourceModel ( _, _, kind , _ ) }
689
707
}
690
708
691
709
private module KindVal = SharedModelVal:: KindValidation< KindValConfig > ;
0 commit comments