Skip to content

Commit f01e030

Browse files
committed
Improve and re-use UI5::inSameWebApp() predicate
1 parent 3c580c3 commit f01e030

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

javascript/frameworks/ui5/lib/advanced_security/javascript/frameworks/ui5/RemoteFlowSources.qll

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,14 @@ abstract class UI5ExternalModel extends UI5Model, RemoteFlowSource {
113113
/** Default model which gains content from an SAP OData service (ie no model name is explicitly specified). */
114114
class DefaultODataServiceModel extends UI5ExternalModel {
115115
DefaultODataServiceModel() {
116-
exists(ExternalModelManifest model, WebApp webapp |
117-
//an OData default model exists
116+
exists(ExternalModelManifest model |
117+
// An OData default model exists.
118118
model.getName() = "" and
119119
model.getDataSource() instanceof ODataDataSourceManifest and
120-
//therefore the bindElement calls that exist may be sources and also approximates the model itself
120+
// A bindElement call bound to the default OData model represents a source of data.
121121
this.getCalleeName() = "bindElement" and
122-
// The bindElement call must be in the same webapp as the manifest that declares the default model
123-
webapp.getAResource() = this.getFile() and
124-
webapp.getManifest() = model.getJsonFile()
122+
// The bindElement call must be in the same webapp as the manifest that declares the default model.
123+
inSameWebApp(this.getFile(), model.getJsonFile())
125124
)
126125
}
127126

javascript/frameworks/ui5/lib/advanced_security/javascript/frameworks/ui5/UI5.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ bindingset[f1, f2]
8888
pragma[inline_late]
8989
predicate inSameWebApp(File f1, File f2) {
9090
exists(WebApp webApp | webApp.getAResource() = f1 and webApp.getAResource() = f2)
91+
or
92+
exists(WebApp webApp | webApp.getManifest() = f1 and webApp.getAResource() = f2)
93+
or
94+
exists(WebApp webApp | webApp.getManifest() = f2 and webApp.getAResource() = f1)
9195
}
9296

9397
/** A UI5 bootstrapped web application. */

0 commit comments

Comments
 (0)