@@ -112,33 +112,37 @@ predicate interpretModelForTest(QlBuiltins::ExtensionId madId, string model) {
112112}
113113
114114private class SummarizedCallableFromModel extends SummarizedCallable:: Range {
115- private string path ;
115+ string input_ ;
116+ string output_ ;
117+ string kind ;
118+ Provenance p_ ;
119+ boolean isExact_ ;
120+ QlBuiltins:: ExtensionId madId ;
116121
117122 SummarizedCallableFromModel ( ) {
118- summaryModel ( path , _, _, _, _, _) and
119- this .getCanonicalPath ( ) = path
120- }
121-
122- override predicate hasProvenance ( Provenance provenance ) {
123- summaryModel ( path , _, _, _, provenance , _)
123+ exists ( string path , Function f |
124+ summaryModel ( path , input_ , output_ , kind , p_ , madId ) and
125+ f .getCanonicalPath ( ) = path
126+ |
127+ this = f and isExact_ = true
128+ or
129+ // only apply trait models to concrete implementations when they are not
130+ // defined in source code
131+ this .implements ( f ) and
132+ isExact_ = false and
133+ not this .fromSource ( )
134+ )
124135 }
125136
126- private predicate hasManualModel ( ) { summaryModel ( path , _, _, _, "manual" , _) }
127-
128137 override predicate propagatesFlow (
129- string input , string output , boolean preservesValue , string model
138+ string input , string output , boolean preservesValue , Provenance p , boolean isExact , string model
130139 ) {
131- exists ( string kind , string provenance , QlBuiltins:: ExtensionId madId |
132- summaryModel ( path , input , output , kind , provenance , madId ) and
133- model = "MaD:" + madId .toString ( ) and
134- ( provenance = "manual" or not this .hasManualModel ( ) )
135- |
136- kind = "value" and
137- preservesValue = true
138- or
139- kind = "taint" and
140- preservesValue = false
141- )
140+ input = input_ and
141+ output = output_ and
142+ ( if kind = "value" then preservesValue = true else preservesValue = false ) and
143+ p = p_ and
144+ isExact = isExact_ and
145+ model = "MaD:" + madId .toString ( )
142146 }
143147}
144148
0 commit comments