@@ -117,13 +117,6 @@ private predicate sinkModel(string row) { any(SinkModelCsv s).row(row) }
117117
118118private predicate summaryModel ( string row ) { any ( SummaryModelCsv s ) .row ( row ) }
119119
120- bindingset [ input]
121- private predicate getKind ( string input , string kind , boolean generated ) {
122- input .splitAt ( ":" , 0 ) = "generated" and kind = input .splitAt ( ":" , 1 ) and generated = true
123- or
124- not input .matches ( "%:%" ) and kind = input and generated = false
125- }
126-
127120/** Holds if a source model exists for the given parameters. */
128121predicate sourceModel (
129122 string namespace , string type , boolean subtypes , string name , string signature , string ext ,
@@ -139,8 +132,9 @@ predicate sourceModel(
139132 row .splitAt ( ";" , 4 ) = signature and
140133 row .splitAt ( ";" , 5 ) = ext and
141134 row .splitAt ( ";" , 6 ) = output and
142- exists ( string k | row .splitAt ( ";" , 7 ) = k and getKind ( k , kind , generated ) )
143- )
135+ row .splitAt ( ";" , 7 ) = kind
136+ ) and
137+ generated = false
144138}
145139
146140/** Holds if a sink model exists for the given parameters. */
@@ -158,8 +152,9 @@ predicate sinkModel(
158152 row .splitAt ( ";" , 4 ) = signature and
159153 row .splitAt ( ";" , 5 ) = ext and
160154 row .splitAt ( ";" , 6 ) = input and
161- exists ( string k | row .splitAt ( ";" , 7 ) = k and getKind ( k , kind , generated ) )
162- )
155+ row .splitAt ( ";" , 7 ) = kind
156+ ) and
157+ generated = false
163158}
164159
165160/** Holds if a summary model exists for the given parameters. */
@@ -178,8 +173,9 @@ predicate summaryModel(
178173 row .splitAt ( ";" , 5 ) = ext and
179174 row .splitAt ( ";" , 6 ) = input and
180175 row .splitAt ( ";" , 7 ) = output and
181- exists ( string k | row .splitAt ( ";" , 8 ) = k and getKind ( k , kind , generated ) )
182- )
176+ row .splitAt ( ";" , 8 ) = kind
177+ ) and
178+ generated = false
183179}
184180
185181private predicate relevantNamespace ( string namespace ) {
@@ -313,26 +309,11 @@ module CsvValidation {
313309 )
314310 )
315311 or
316- exists ( string row , string k , string kind | summaryModel ( row ) |
317- k = row .splitAt ( ";" , 8 ) and
318- getKind ( k , kind , _) and
312+ exists ( string row , string kind | summaryModel ( row ) |
313+ kind = row .splitAt ( ";" , 8 ) and
319314 not kind = [ "taint" , "value" ] and
320315 msg = "Invalid kind \"" + kind + "\" in summary model."
321316 )
322- or
323- exists ( string row , string k , string kind | sinkModel ( row ) |
324- k = row .splitAt ( ";" , 7 ) and
325- getKind ( k , kind , _) and
326- not kind = [ "code" , "sql" , "xss" , "remote" , "html" ] and
327- msg = "Invalid kind \"" + kind + "\" in sink model."
328- )
329- or
330- exists ( string row , string k , string kind | sourceModel ( row ) |
331- k = row .splitAt ( ";" , 7 ) and
332- getKind ( k , kind , _) and
333- not kind = "local" and
334- msg = "Invalid kind \"" + kind + "\" in source model."
335- )
336317 }
337318}
338319
0 commit comments