Skip to content

Commit 2200796

Browse files
Merge pull request #88 from advanced-security/mbaluda-same-app
Path should not cross different apps
2 parents b0754d6 + d1f612e commit 2200796

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

.github/codeql/codeql-config.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
name: "My CodeQL config"
22

33
queries:
4-
# for log-injection
5-
- uses: security-and-quality
6-
# for ui5 queries
7-
- uses: ./javascript/frameworks/ui5/src
4+
- uses: security-extended
5+
# for ui5/cap queries
6+
- uses: ./javascript/frameworks/ui5/src/codeql-suites/sap-ui5-security-extended.qls
7+
- uses: ./javascript/frameworks/cap/src
88

99
paths:
1010
- "**/*.xml"
1111
- "**/*.json"
12-
12+
paths-ignore:
13+
- "**/frameworks/*/test/models"

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

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -145,28 +145,29 @@ abstract class UI5BindingPath extends BindingPath {
145145
* Gets the `DataFlow::Node` that represents this binding path.
146146
*/
147147
Node getNode() {
148-
/* 1-1. Internal (Client-side) model, model hardcoded in JS code */
149-
exists(Property p, JsonModel model |
150-
/* Get the property of an JS object bound to this binding path. */
151-
result.(DataFlow::PropWrite).getPropertyNameExpr() = p.getNameExpr() and
152-
this.getAbsolutePath() = model.getPathString(p) and
153-
/* Restrict search to inside the same webapp. */
154-
exists(WebApp webApp |
155-
webApp.getAResource() = this.getLocation().getFile() and
156-
webApp.getAResource() = result.getFile()
148+
/* Restrict search to the same webapp. */
149+
exists(WebApp webApp |
150+
webApp.getAResource() = this.getLocation().getFile() and
151+
webApp.getAResource() = result.getFile()
152+
|
153+
/* 1-1. Internal (Client-side) model, model hardcoded in JS code */
154+
exists(Property p, JsonModel model |
155+
/* Get the property of an JS object bound to this binding path. */
156+
result.(DataFlow::PropWrite).getPropertyNameExpr() = p.getNameExpr() and
157+
this.getAbsolutePath() = model.getPathString(p)
157158
)
159+
or
160+
/* 1-2. Internal (Client-side) model, model loaded from JSON file */
161+
exists(string propName, JsonModel model |
162+
/* Get the property of an JS object bound to this binding path. */
163+
result = model.getArgument(0).getALocalSource() and
164+
this.getPath() = model.getPathStringPropName(propName) and
165+
exists(JsonObject obj, JsonValue val | val = obj.getPropValue(propName))
166+
)
167+
or
168+
/* 2. External (Server-side) model */
169+
result = this.getModel().(UI5ExternalModel)
158170
)
159-
or
160-
/* 1-2. Internal (Client-side) model, model loaded from JSON file */
161-
exists(string propName, JsonModel model |
162-
/* Get the property of an JS object bound to this binding path. */
163-
result = model.getArgument(0).getALocalSource() and
164-
this.getPath() = model.getPathStringPropName(propName) and
165-
exists(JsonObject obj, JsonValue val | val = obj.getPropValue(propName))
166-
)
167-
or
168-
/* 2. External (Server-side) model */
169-
result = this.getModel().(UI5ExternalModel)
170171
}
171172
}
172173

0 commit comments

Comments
 (0)