Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,7 @@ module ManifestJson {
}

/** The manifest.json file serving as the app descriptor. */
pragma[nomagic]
private string constructPathStringInner(Expr object) {
if not object instanceof ObjectExpr
then result = ""
Expand Down Expand Up @@ -1117,6 +1118,7 @@ module ManifestJson {
)
}

pragma[nomagic]
private string constructPathStringInner(Expr object, Property property) {
if not object instanceof ObjectExpr
then result = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,23 +147,10 @@ abstract class UI5BindingPath extends BindingPath {
*/
Node getNode() {
/* 1-1. Internal (Client-side) model, model hardcoded in JS code */
exists(Property p, JsonModel model |
/* Get the property of an JS object bound to this binding path. */
result.(DataFlow::PropWrite).getPropertyNameExpr() = p.getNameExpr() and
this.getAbsolutePath() = model.getPathString(p) and
/* Restrict search to inside the same webapp. */
inSameWebApp(this.getLocation().getFile(), result.getFile())
)
result = getHardcodedJsonModelNode(this)
or
/* 1-2. Internal (Client-side) model, model loaded from JSON file */
exists(string propName, JsonModel model |
/* Get the property of an JS object bound to this binding path. */
result = model.getArgument(0).getALocalSource() and
this.getPath() = model.getPathStringPropName(propName) and
exists(JsonObject obj, JsonValue val | val = obj.getPropValue(propName)) and
/* Restrict search to inside the same webapp. */
inSameWebApp(this.getLocation().getFile(), result.getFile())
)
result = getJsonFileModelNode(this)
or
/* 1-3. Internal (Client-side) model, content not statically visible */
result = getNonStaticJsonModelNode(this)
Expand Down Expand Up @@ -198,6 +185,42 @@ private DefaultODataServiceModel getDefaultODataModel(UI5BindingPath bindingPath
)
}

/**
* Gets the `DataFlow::Node` for a binding path whose model data is hardcoded
* in a JS object literal. Matches the property write in the object against
* the binding path's absolute path.
*
* `nomagic` to prevent the `getAbsolutePath() = model.getPathString(p)` join
* from being inlined into `getNode()`, which caused a cross-product explosion
* on large codebases.
*/
pragma[nomagic]
private Node getHardcodedJsonModelNode(UI5BindingPath bindingPath) {
exists(Property p, JsonModel model |
result.(DataFlow::PropWrite).getPropertyNameExpr() = p.getNameExpr() and
bindingPath.getAbsolutePath() = model.getPathString(p) and
inSameWebApp(bindingPath.getLocation().getFile(), result.getFile())
)
}

/**
* Gets the `DataFlow::Node` for a binding path whose model data is loaded
* from a JSON file.
*
* `nomagic` to prevent the `getPath() = model.getPathStringPropName(propName)` join
* from being inlined into `getNode()`, which caused a cross-product explosion
* on large codebases.
*/
pragma[nomagic]
private Node getJsonFileModelNode(UI5BindingPath bindingPath) {
exists(string propName, JsonModel model |
result = model.getArgument(0).getALocalSource() and
bindingPath.getPath() = model.getPathStringPropName(propName) and
exists(JsonObject obj, JsonValue val | val = obj.getPropValue(propName)) and
inSameWebApp(bindingPath.getLocation().getFile(), result.getFile())
)
}

/**
* Gets the `DataFlow::Node` for a non-statically-visible `JsonModel`.
*
Expand Down
Loading