@@ -161,41 +161,57 @@ private module Frameworks {
161
161
}
162
162
163
163
/**
164
+ * DEPRECATED: Define source models as data extensions instead.
165
+ *
164
166
* A unit class for adding additional source model rows.
165
167
*
166
168
* Extend this class to add additional source definitions.
167
169
*/
168
- class SourceModelCsv extends Unit {
170
+ class SourceModelCsv = SourceModelCsvInternal ;
171
+
172
+ private class SourceModelCsvInternal extends Unit {
169
173
/** Holds if `row` specifies a source definition. */
170
174
abstract predicate row ( string row ) ;
171
175
}
172
176
173
177
/**
178
+ * DEPRECATED: Define sink models as data extensions instead.
179
+ *
174
180
* A unit class for adding additional sink model rows.
175
181
*
176
182
* Extend this class to add additional sink definitions.
177
183
*/
178
- class SinkModelCsv extends Unit {
184
+ class SinkModelCsv = SinkModelCsvInternal ;
185
+
186
+ private class SinkModelCsvInternal extends Unit {
179
187
/** Holds if `row` specifies a sink definition. */
180
188
abstract predicate row ( string row ) ;
181
189
}
182
190
183
191
/**
192
+ * DEPRECATED: Define summary models as data extensions instead.
193
+ *
184
194
* A unit class for adding additional summary model rows.
185
195
*
186
196
* Extend this class to add additional flow summary definitions.
187
197
*/
188
- class SummaryModelCsv extends Unit {
198
+ class SummaryModelCsv = SummaryModelCsvInternal ;
199
+
200
+ private class SummaryModelCsvInternal extends Unit {
189
201
/** Holds if `row` specifies a summary definition. */
190
202
abstract predicate row ( string row ) ;
191
203
}
192
204
193
205
/**
194
- * A unit class for adding negative summary model rows .
206
+ * DEPRECATED: Define negative summary models as data extensions instead .
195
207
*
196
- * Extend this class to add additional flow summary definitions.
208
+ * A unit class for adding additional negative summary model rows.
209
+ *
210
+ * Extend this class to add additional negative summary definitions.
197
211
*/
198
- class NegativeSummaryModelCsv extends Unit {
212
+ class NegativeSummaryModelCsv = NegativeSummaryModelCsvInternal ;
213
+
214
+ private class NegativeSummaryModelCsvInternal extends Unit {
199
215
/** Holds if `row` specifies a negative summary definition. */
200
216
abstract predicate row ( string row ) ;
201
217
}
@@ -420,17 +436,15 @@ private class SummaryModelCsvBase extends SummaryModelCsv {
420
436
}
421
437
}
422
438
423
- /** Holds if `row` is a source model. */
424
- predicate sourceModel ( string row ) { any ( SourceModelCsv s ) .row ( row ) }
439
+ private predicate sourceModelInternal ( string row ) { any ( SourceModelCsvInternal s ) .row ( row ) }
425
440
426
- /** Holds if `row` is a sink model. */
427
- predicate sinkModel ( string row ) { any ( SinkModelCsv s ) .row ( row ) }
441
+ private predicate summaryModelInternal ( string row ) { any ( SummaryModelCsvInternal s ) .row ( row ) }
428
442
429
- /** Holds if `row` is a summary model. */
430
- predicate summaryModel ( string row ) { any ( SummaryModelCsv s ) .row ( row ) }
443
+ private predicate sinkModelInternal ( string row ) { any ( SinkModelCsvInternal s ) .row ( row ) }
431
444
432
- /** Holds if `row` is negative summary model. */
433
- predicate negativeSummaryModel ( string row ) { any ( NegativeSummaryModelCsv s ) .row ( row ) }
445
+ private predicate negativeSummaryModelInternal ( string row ) {
446
+ any ( NegativeSummaryModelCsvInternal s ) .row ( row )
447
+ }
434
448
435
449
/**
436
450
* Holds if a source model exists for the given parameters.
@@ -446,7 +460,7 @@ predicate sourceModel(
446
460
string output , string kind , string provenance
447
461
) {
448
462
exists ( string row |
449
- sourceModel ( row ) and
463
+ sourceModelInternal ( row ) and
450
464
row .splitAt ( ";" , 0 ) = package and
451
465
row .splitAt ( ";" , 1 ) = type and
452
466
row .splitAt ( ";" , 2 ) = subtypes .toString ( ) and
@@ -458,6 +472,8 @@ predicate sourceModel(
458
472
row .splitAt ( ";" , 7 ) = kind and
459
473
row .splitAt ( ";" , 8 ) = provenance
460
474
)
475
+ or
476
+ extSourceModel ( package , type , subtypes , name , signature , ext , output , kind , provenance )
461
477
}
462
478
463
479
/** Holds if a sink model exists for the given parameters. */
@@ -472,7 +488,7 @@ predicate sinkModel(
472
488
string input , string kind , string provenance
473
489
) {
474
490
exists ( string row |
475
- sinkModel ( row ) and
491
+ sinkModelInternal ( row ) and
476
492
row .splitAt ( ";" , 0 ) = package and
477
493
row .splitAt ( ";" , 1 ) = type and
478
494
row .splitAt ( ";" , 2 ) = subtypes .toString ( ) and
@@ -484,6 +500,8 @@ predicate sinkModel(
484
500
row .splitAt ( ";" , 7 ) = kind and
485
501
row .splitAt ( ";" , 8 ) = provenance
486
502
)
503
+ or
504
+ extSinkModel ( package , type , subtypes , name , signature , ext , input , kind , provenance )
487
505
}
488
506
489
507
/** Holds if a summary model exists for the given parameters. */
@@ -497,26 +515,42 @@ predicate summaryModel(
497
515
string package , string type , boolean subtypes , string name , string signature , string ext ,
498
516
string input , string output , string kind , string provenance
499
517
) {
500
- summaryModel ( package , type , subtypes , name , signature , ext , input , output , kind , provenance , _)
518
+ exists ( string row |
519
+ summaryModelInternal ( row ) and
520
+ row .splitAt ( ";" , 0 ) = package and
521
+ row .splitAt ( ";" , 1 ) = type and
522
+ row .splitAt ( ";" , 2 ) = subtypes .toString ( ) and
523
+ subtypes = [ true , false ] and
524
+ row .splitAt ( ";" , 3 ) = name and
525
+ row .splitAt ( ";" , 4 ) = signature and
526
+ row .splitAt ( ";" , 5 ) = ext and
527
+ row .splitAt ( ";" , 6 ) = input and
528
+ row .splitAt ( ";" , 7 ) = output and
529
+ row .splitAt ( ";" , 8 ) = kind and
530
+ row .splitAt ( ";" , 9 ) = provenance
531
+ )
532
+ or
533
+ extSummaryModel ( package , type , subtypes , name , signature , ext , input , output , kind , provenance )
501
534
}
502
535
503
536
/** Holds if a summary model `row` exists for the given parameters. */
537
+ bindingset [ row]
504
538
predicate summaryModel (
505
539
string package , string type , boolean subtypes , string name , string signature , string ext ,
506
540
string input , string output , string kind , string provenance , string row
507
541
) {
508
- summaryModel ( row ) and
509
- row . splitAt ( ";" , 0 ) = package and
510
- row . splitAt ( ";" , 1 ) = type and
511
- row . splitAt ( ";" , 2 ) = subtypes . toString ( ) and
512
- subtypes = [ true , false ] and
513
- row . splitAt ( ";" , 3 ) = name and
514
- row . splitAt ( ";" , 4 ) = signature and
515
- row . splitAt ( ";" , 5 ) = ext and
516
- row . splitAt ( ";" , 6 ) = input and
517
- row . splitAt ( ";" , 7 ) = output and
518
- row . splitAt ( ";" , 8 ) = kind and
519
- row . splitAt ( ";" , 9 ) = provenance
542
+ summaryModel ( package , type , subtypes , name , signature , ext , input , output , kind , provenance ) and
543
+ row =
544
+ package + ";" //
545
+ + type + ";" //
546
+ + subtypes . toString ( ) + ";" //
547
+ + name + ";" //
548
+ + signature + ";" //
549
+ + ext + ";" //
550
+ + input + ";" //
551
+ + output + ";" //
552
+ + kind + ";" //
553
+ + provenance
520
554
}
521
555
522
556
/** Holds if a summary model exists indicating there is no flow for the given parameters. */
@@ -529,19 +563,21 @@ predicate negativeSummaryModel(
529
563
string package , string type , string name , string signature , string provenance
530
564
) {
531
565
exists ( string row |
532
- negativeSummaryModel ( row ) and
566
+ negativeSummaryModelInternal ( row ) and
533
567
row .splitAt ( ";" , 0 ) = package and
534
568
row .splitAt ( ";" , 1 ) = type and
535
569
row .splitAt ( ";" , 2 ) = name and
536
570
row .splitAt ( ";" , 3 ) = signature and
537
571
row .splitAt ( ";" , 4 ) = provenance
538
572
)
573
+ or
574
+ extNegativeSummaryModel ( package , type , name , signature , provenance )
539
575
}
540
576
541
577
private predicate relevantPackage ( string package ) {
542
578
sourceModel ( package , _, _, _, _, _, _, _, _) or
543
579
sinkModel ( package , _, _, _, _, _, _, _, _) or
544
- summaryModel ( package , _, _, _, _, _, _, _, _, _, _ )
580
+ summaryModel ( package , _, _, _, _, _, _, _, _, _)
545
581
}
546
582
547
583
private predicate packageLink ( string shortpkg , string longpkg ) {
@@ -627,14 +663,12 @@ module ModelValidation {
627
663
}
628
664
629
665
private string getInvalidModelKind ( ) {
630
- exists ( string row , string kind | summaryModel ( row ) |
631
- kind = row .splitAt ( ";" , 8 ) and
666
+ exists ( string kind | summaryModel ( _, _, _, _, _, _, _, _, kind , _) |
632
667
not kind = [ "taint" , "value" ] and
633
668
result = "Invalid kind \"" + kind + "\" in summary model."
634
669
)
635
670
or
636
- exists ( string row , string kind | sinkModel ( row ) |
637
- kind = row .splitAt ( ";" , 7 ) and
671
+ exists ( string kind | sinkModel ( _, _, _, _, _, _, _, kind , _) |
638
672
not kind =
639
673
[
640
674
"open-url" , "jndi-injection" , "ldap" , "sql" , "jdbc-url" , "logging" , "mvel" , "xpath" ,
@@ -648,8 +682,7 @@ module ModelValidation {
648
682
result = "Invalid kind \"" + kind + "\" in sink model."
649
683
)
650
684
or
651
- exists ( string row , string kind | sourceModel ( row ) |
652
- kind = row .splitAt ( ";" , 7 ) and
685
+ exists ( string kind | sourceModel ( _, _, _, _, _, _, _, kind , _) |
653
686
not kind = [ "remote" , "contentprovider" , "android-widget" , "android-external-storage-dir" ] and
654
687
not kind .matches ( "qltest%" ) and
655
688
result = "Invalid kind \"" + kind + "\" in source model."
@@ -658,11 +691,11 @@ module ModelValidation {
658
691
659
692
private string getInvalidModelSubtype ( ) {
660
693
exists ( string pred , string row |
661
- sourceModel ( row ) and pred = "source"
694
+ sourceModelInternal ( row ) and pred = "source"
662
695
or
663
- sinkModel ( row ) and pred = "sink"
696
+ sinkModelInternal ( row ) and pred = "sink"
664
697
or
665
- summaryModel ( row ) and pred = "summary"
698
+ summaryModelInternal ( row ) and pred = "summary"
666
699
|
667
700
exists ( string b |
668
701
b = row .splitAt ( ";" , 2 ) and
@@ -674,13 +707,13 @@ module ModelValidation {
674
707
675
708
private string getInvalidModelColumnCount ( ) {
676
709
exists ( string pred , string row , int expect |
677
- sourceModel ( row ) and expect = 9 and pred = "source"
710
+ sourceModelInternal ( row ) and expect = 9 and pred = "source"
678
711
or
679
- sinkModel ( row ) and expect = 9 and pred = "sink"
712
+ sinkModelInternal ( row ) and expect = 9 and pred = "sink"
680
713
or
681
- summaryModel ( row ) and expect = 10 and pred = "summary"
714
+ summaryModelInternal ( row ) and expect = 10 and pred = "summary"
682
715
or
683
- negativeSummaryModel ( row ) and expect = 5 and pred = "negative summary"
716
+ negativeSummaryModelInternal ( row ) and expect = 5 and pred = "negative summary"
684
717
|
685
718
exists ( int cols |
686
719
cols = 1 + max ( int n | exists ( row .splitAt ( ";" , n ) ) ) and
0 commit comments