@@ -161,41 +161,57 @@ private module Frameworks {
161161}
162162
163163/**
164+ * DEPRECATED: Define source models as data extensions instead.
165+ *
164166 * A unit class for adding additional source model rows.
165167 *
166168 * Extend this class to add additional source definitions.
167169 */
168- class SourceModelCsv extends Unit {
170+ class SourceModelCsv = SourceModelCsvInternal ;
171+
172+ private class SourceModelCsvInternal extends Unit {
169173 /** Holds if `row` specifies a source definition. */
170174 abstract predicate row ( string row ) ;
171175}
172176
173177/**
178+ * DEPRECATED: Define sink models as data extensions instead.
179+ *
174180 * A unit class for adding additional sink model rows.
175181 *
176182 * Extend this class to add additional sink definitions.
177183 */
178- class SinkModelCsv extends Unit {
184+ class SinkModelCsv = SinkModelCsvInternal ;
185+
186+ private class SinkModelCsvInternal extends Unit {
179187 /** Holds if `row` specifies a sink definition. */
180188 abstract predicate row ( string row ) ;
181189}
182190
183191/**
192+ * DEPRECATED: Define summary models as data extensions instead.
193+ *
184194 * A unit class for adding additional summary model rows.
185195 *
186196 * Extend this class to add additional flow summary definitions.
187197 */
188- class SummaryModelCsv extends Unit {
198+ class SummaryModelCsv = SummaryModelCsvInternal ;
199+
200+ private class SummaryModelCsvInternal extends Unit {
189201 /** Holds if `row` specifies a summary definition. */
190202 abstract predicate row ( string row ) ;
191203}
192204
193205/**
194- * A unit class for adding negative summary model rows .
206+ * DEPRECATED: Define negative summary models as data extensions instead .
195207 *
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.
197211 */
198- class NegativeSummaryModelCsv extends Unit {
212+ class NegativeSummaryModelCsv = NegativeSummaryModelCsvInternal ;
213+
214+ private class NegativeSummaryModelCsvInternal extends Unit {
199215 /** Holds if `row` specifies a negative summary definition. */
200216 abstract predicate row ( string row ) ;
201217}
@@ -420,17 +436,15 @@ private class SummaryModelCsvBase extends SummaryModelCsv {
420436 }
421437}
422438
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 ) }
425440
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 ) }
428442
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 ) }
431444
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+ }
434448
435449/**
436450 * Holds if a source model exists for the given parameters.
@@ -446,7 +460,7 @@ predicate sourceModel(
446460 string output , string kind , string provenance
447461) {
448462 exists ( string row |
449- sourceModel ( row ) and
463+ sourceModelInternal ( row ) and
450464 row .splitAt ( ";" , 0 ) = package and
451465 row .splitAt ( ";" , 1 ) = type and
452466 row .splitAt ( ";" , 2 ) = subtypes .toString ( ) and
@@ -458,6 +472,8 @@ predicate sourceModel(
458472 row .splitAt ( ";" , 7 ) = kind and
459473 row .splitAt ( ";" , 8 ) = provenance
460474 )
475+ or
476+ extSourceModel ( package , type , subtypes , name , signature , ext , output , kind , provenance )
461477}
462478
463479/** Holds if a sink model exists for the given parameters. */
@@ -472,7 +488,7 @@ predicate sinkModel(
472488 string input , string kind , string provenance
473489) {
474490 exists ( string row |
475- sinkModel ( row ) and
491+ sinkModelInternal ( row ) and
476492 row .splitAt ( ";" , 0 ) = package and
477493 row .splitAt ( ";" , 1 ) = type and
478494 row .splitAt ( ";" , 2 ) = subtypes .toString ( ) and
@@ -484,6 +500,8 @@ predicate sinkModel(
484500 row .splitAt ( ";" , 7 ) = kind and
485501 row .splitAt ( ";" , 8 ) = provenance
486502 )
503+ or
504+ extSinkModel ( package , type , subtypes , name , signature , ext , input , kind , provenance )
487505}
488506
489507/** Holds if a summary model exists for the given parameters. */
@@ -497,26 +515,42 @@ predicate summaryModel(
497515 string package , string type , boolean subtypes , string name , string signature , string ext ,
498516 string input , string output , string kind , string provenance
499517) {
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 )
501534}
502535
503536/** Holds if a summary model `row` exists for the given parameters. */
537+ bindingset [ row]
504538predicate summaryModel (
505539 string package , string type , boolean subtypes , string name , string signature , string ext ,
506540 string input , string output , string kind , string provenance , string row
507541) {
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
520554}
521555
522556/** Holds if a summary model exists indicating there is no flow for the given parameters. */
@@ -529,19 +563,21 @@ predicate negativeSummaryModel(
529563 string package , string type , string name , string signature , string provenance
530564) {
531565 exists ( string row |
532- negativeSummaryModel ( row ) and
566+ negativeSummaryModelInternal ( row ) and
533567 row .splitAt ( ";" , 0 ) = package and
534568 row .splitAt ( ";" , 1 ) = type and
535569 row .splitAt ( ";" , 2 ) = name and
536570 row .splitAt ( ";" , 3 ) = signature and
537571 row .splitAt ( ";" , 4 ) = provenance
538572 )
573+ or
574+ extNegativeSummaryModel ( package , type , name , signature , provenance )
539575}
540576
541577private predicate relevantPackage ( string package ) {
542578 sourceModel ( package , _, _, _, _, _, _, _, _) or
543579 sinkModel ( package , _, _, _, _, _, _, _, _) or
544- summaryModel ( package , _, _, _, _, _, _, _, _, _, _ )
580+ summaryModel ( package , _, _, _, _, _, _, _, _, _)
545581}
546582
547583private predicate packageLink ( string shortpkg , string longpkg ) {
@@ -627,14 +663,12 @@ module ModelValidation {
627663 }
628664
629665 private string getInvalidModelKind ( ) {
630- exists ( string row , string kind | summaryModel ( row ) |
631- kind = row .splitAt ( ";" , 8 ) and
666+ exists ( string kind | summaryModel ( _, _, _, _, _, _, _, _, kind , _) |
632667 not kind = [ "taint" , "value" ] and
633668 result = "Invalid kind \"" + kind + "\" in summary model."
634669 )
635670 or
636- exists ( string row , string kind | sinkModel ( row ) |
637- kind = row .splitAt ( ";" , 7 ) and
671+ exists ( string kind | sinkModel ( _, _, _, _, _, _, _, kind , _) |
638672 not kind =
639673 [
640674 "open-url" , "jndi-injection" , "ldap" , "sql" , "jdbc-url" , "logging" , "mvel" , "xpath" ,
@@ -648,8 +682,7 @@ module ModelValidation {
648682 result = "Invalid kind \"" + kind + "\" in sink model."
649683 )
650684 or
651- exists ( string row , string kind | sourceModel ( row ) |
652- kind = row .splitAt ( ";" , 7 ) and
685+ exists ( string kind | sourceModel ( _, _, _, _, _, _, _, kind , _) |
653686 not kind = [ "remote" , "contentprovider" , "android-widget" , "android-external-storage-dir" ] and
654687 not kind .matches ( "qltest%" ) and
655688 result = "Invalid kind \"" + kind + "\" in source model."
@@ -658,11 +691,11 @@ module ModelValidation {
658691
659692 private string getInvalidModelSubtype ( ) {
660693 exists ( string pred , string row |
661- sourceModel ( row ) and pred = "source"
694+ sourceModelInternal ( row ) and pred = "source"
662695 or
663- sinkModel ( row ) and pred = "sink"
696+ sinkModelInternal ( row ) and pred = "sink"
664697 or
665- summaryModel ( row ) and pred = "summary"
698+ summaryModelInternal ( row ) and pred = "summary"
666699 |
667700 exists ( string b |
668701 b = row .splitAt ( ";" , 2 ) and
@@ -674,13 +707,13 @@ module ModelValidation {
674707
675708 private string getInvalidModelColumnCount ( ) {
676709 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"
678711 or
679- sinkModel ( row ) and expect = 9 and pred = "sink"
712+ sinkModelInternal ( row ) and expect = 9 and pred = "sink"
680713 or
681- summaryModel ( row ) and expect = 10 and pred = "summary"
714+ summaryModelInternal ( row ) and expect = 10 and pred = "summary"
682715 or
683- negativeSummaryModel ( row ) and expect = 5 and pred = "negative summary"
716+ negativeSummaryModelInternal ( row ) and expect = 5 and pred = "negative summary"
684717 |
685718 exists ( int cols |
686719 cols = 1 + max ( int n | exists ( row .splitAt ( ";" , n ) ) ) and
0 commit comments