Skip to content

Commit 0a7b668

Browse files
committed
Add more tests
1 parent 1ec8bfa commit 0a7b668

File tree

33 files changed

+11530
-5
lines changed

33 files changed

+11530
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ class XmlView extends UI5View instanceof XmlFile {
653653
getASuperType(type) = "UI5HTMLControl" and
654654
// `sap.ui.core.HTML` controls are not sinks if the `sanitizeContent` attribute set to true
655655
control.getAttribute("sanitizeContent").getValue() = "true"
656-
// TODO: unless progeammatically set ot false
656+
// TODO: unless progeammatically set to false
657657
)
658658
)
659659
}

javascript/frameworks/ui5/test/queries/UI5Xss/xss-html-control-df sanitized-disable/webapp/controller/app.controller.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ sap.ui.define([
1313
this.getView().setModel(oModel);
1414

1515
// enable sanitization programmatically
16-
this.getView().setProperty("sanitizeContent", false);
1716
this.getView().byId("htmlControl").setProperty("sanitizeContent", false);
1817
this.getView().byId("htmlControl").sanitizeContent = false;
1918

javascript/frameworks/ui5/test/queries/UI5Xss/xss-html-control-df sanitized/webapp/controller/app.controller.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ sap.ui.define([
1313
this.getView().setModel(oModel);
1414

1515
// enable sanitization programmatically
16-
//this.getView().setProperty("sanitizeContent", true);
17-
this.getView().byId("htmlControl").setProperty("sanitizeContent", true);
18-
this.getView().byId("htmlControl").sanitizeContent = true;
16+
this.getView().byId("htmlControl").setProperty("sanitizeContent", false);
17+
this.getView().byId("htmlControl").sanitizeContent = false;
1918

2019
var input = oModel.getProperty('/input');
2120
oModel.setProperty('/output', input);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
nodes
2+
| webapp/controller/app.controller.js:9:17:9:27 | input: null |
3+
| webapp/view/app.view.html:5:11:5:31 | data-value={/input} |
4+
| webapp/view/app.view.html:8:11:8:33 | data-content={/input} |
5+
edges
6+
| webapp/controller/app.controller.js:9:17:9:27 | input: null | webapp/view/app.view.html:5:11:5:31 | data-value={/input} |
7+
| webapp/controller/app.controller.js:9:17:9:27 | input: null | webapp/view/app.view.html:8:11:8:33 | data-content={/input} |
8+
| webapp/controller/app.controller.js:11:26:11:45 | new JSONModel(oData) | webapp/view/app.view.html:8:11:8:33 | data-content={/input} |
9+
| webapp/view/app.view.html:5:11:5:31 | data-value={/input} | webapp/controller/app.controller.js:9:17:9:27 | input: null |
10+
| webapp/view/app.view.html:5:11:5:31 | data-value={/input} | webapp/controller/app.controller.js:11:26:11:45 | new JSONModel(oData) |
11+
| webapp/view/app.view.html:8:11:8:33 | data-content={/input} | webapp/controller/app.controller.js:9:17:9:27 | input: null |
12+
#select
13+
| webapp/view/app.view.html:8:11:8:33 | data-content={/input} | webapp/view/app.view.html:5:11:5:31 | data-value={/input} | webapp/view/app.view.html:8:11:8:33 | data-content={/input} | XSS vulnerability due to $@. | webapp/view/app.view.html:5:11:5:31 | data-value={/input} | user-provided value |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
UI5Xss/UI5Xss.ql

javascript/frameworks/ui5/test/queries/UI5Xss/xss-html-view sanitized/package-lock.json

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "sap-ui5-xss",
3+
"version": "1.0.0",
4+
"main": "index.js"
5+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
specVersion: '3.0'
2+
metadata:
3+
name: sap-ui5-xss
4+
type: application
5+
framework:
6+
name: SAPUI5
7+
version: "1.115.0"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
sap.ui.define([
2+
"sap/ui/core/mvc/Controller",
3+
"sap/ui/model/json/JSONModel"
4+
], function (Controller, JSONModel) {
5+
"use strict"
6+
return Controller.extend("codeql-sap-js.controller.app", {
7+
onInit: function () {
8+
var oData = {
9+
input: null
10+
};
11+
var oModel = new JSONModel(oData);
12+
this.getView().setModel(oModel);
13+
}
14+
});
15+
})
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
6+
<meta charset="utf-8">
7+
<title>SAPUI5 XSS</title>
8+
<script src="https://sdk.openui5.org/resources/sap-ui-core.js"
9+
data-sap-ui-libs="sap.m"
10+
data-sap-ui-onInit="module:codeql-sap-js/index"
11+
data-sap-ui-resourceroots='{
12+
"codeql-sap-js": "./"
13+
}'>
14+
</script>
15+
</head>
16+
17+
<body class="sapUiBody" id="content">
18+
19+
</body>
20+
21+
</html>

0 commit comments

Comments
 (0)