Skip to content

Commit edab90a

Browse files
committed
Source in Control metedata
1 parent 267a929 commit edab90a

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

  • javascript/frameworks/ui5
    • lib/advanced_security/javascript/frameworks/ui5/dataflow
    • test/queries/UI5Xss/xss-custom-control-api2/webapp/control

javascript/frameworks/ui5/lib/advanced_security/javascript/frameworks/ui5/dataflow/UI5DataFlow.qll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,19 @@ class LocalModelContentBoundBidirectionallyToHtmlISinkControl extends DomBasedXs
6161
UI5Control getControlDeclaration() { result = controlDeclaration }
6262
}
6363

64+
class LocalModelStringPropertySource extends DomBasedXss::Source {
65+
LocalModelStringPropertySource() {
66+
exists(UI5BindingPath bindingPath |
67+
this =
68+
bindingPath
69+
.getControlDeclaration()
70+
.getDefinition()
71+
.getMetadata()
72+
.getProperty(bindingPath.getPropertyName())
73+
)
74+
}
75+
}
76+
6477
module UI5PathGraph<PathNodeSig ConfigPathNode, PathGraphSig<ConfigPathNode> ConfigPathGraph> {
6578
private newtype TNode =
6679
TUI5BindingPathNode(UI5BindingPath path) or

javascript/frameworks/ui5/test/queries/UI5Xss/xss-custom-control-api2/webapp/control/xss.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
sap.ui.define([
2-
"sap/ui/core/Control"
3-
], function (Control) {
2+
"sap/ui/core/Control", 'sap/base/security/encodeXML'
3+
], function (Control, EncodeXML) {
44
return Control.extend("codeql-sap-js.control.xss", {
55
metadata: {
66
properties: {
7-
text: { type: "string" }
7+
text: { type: "string" },
8+
text2: { type: "string" }
89
}
910
},
1011
renderer: {
@@ -13,6 +14,13 @@ sap.ui.define([
1314
oRm.openStart("div", oControl);
1415
oRm.unsafeHtml(oControl.getText()); // XSS sink RenderManager.unsafeHtml
1516
oRm.close("div");
17+
18+
oRm.write(`
19+
<div>
20+
<div>${oControl.getText2()}</div>
21+
<div>${EncodeXML(oControl.getText2())}</div>
22+
</div>
23+
`.trim());
1624
}
1725
}
1826
});

0 commit comments

Comments
 (0)