-
Notifications
You must be signed in to change notification settings - Fork 4
Improve UI5Xss.ql query to detect default OData model with bindElement
#283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c36405e
UI5 XSS detect default OData model w/ bindElement
data-douser a6964d5
Update javascript.sarif.expected
data-douser 3c580c3
Fix cross-app isolation for UI5 default OData model
data-douser f01e030
Improve and re-use UI5::inSameWebApp() predicate
data-douser e0ed82a
Merge branch 'main' into dd/default-odata-model-fragments
data-douser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...cript/frameworks/ui5/test/queries/UI5Xss/xss-fragment-odata-default-model/UI5Xss.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| nodes | ||
| | webapp/controller/App.controller.js:21:17:21:53 | oFragme ... es(1)") | | ||
| | webapp/fragments/DataDisplay.fragment.xml:7:9:7:42 | content={message} | | ||
| edges | ||
| | webapp/controller/App.controller.js:21:17:21:53 | oFragme ... es(1)") | webapp/fragments/DataDisplay.fragment.xml:7:9:7:42 | content={message} | | ||
| | webapp/fragments/DataDisplay.fragment.xml:7:9:7:42 | content={message} | webapp/controller/App.controller.js:21:17:21:53 | oFragme ... es(1)") | | ||
| #select | ||
| | webapp/fragments/DataDisplay.fragment.xml:7:9:7:42 | content={message} | webapp/controller/App.controller.js:21:17:21:53 | oFragme ... es(1)") | webapp/fragments/DataDisplay.fragment.xml:7:9:7:42 | content={message} | XSS vulnerability due to $@. | webapp/controller/App.controller.js:21:17:21:53 | oFragme ... es(1)") | user-provided value | |
1 change: 1 addition & 0 deletions
1
javascript/frameworks/ui5/test/queries/UI5Xss/xss-fragment-odata-default-model/UI5Xss.qlref
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| UI5Xss/UI5Xss.ql |
5 changes: 5 additions & 0 deletions
5
javascript/frameworks/ui5/test/queries/UI5Xss/xss-fragment-odata-default-model/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "name": "xss-fragment-odata-default-model", | ||
| "version": "1.0.0", | ||
| "description": "Test case for XSS vulnerability via default OData model in fragment with bindElement" | ||
| } |
7 changes: 7 additions & 0 deletions
7
javascript/frameworks/ui5/test/queries/UI5Xss/xss-fragment-odata-default-model/ui5.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| specVersion: "3.1" | ||
| type: application | ||
| metadata: | ||
| name: xss-fragment-odata-default-model | ||
| framework: | ||
| name: SAPUI5 | ||
| version: "1.120.0" |
13 changes: 13 additions & 0 deletions
13
...t/frameworks/ui5/test/queries/UI5Xss/xss-fragment-odata-default-model/webapp/Component.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| sap.ui.define([ | ||
| "sap/ui/core/UIComponent" | ||
| ], function (UIComponent) { | ||
| "use strict"; | ||
| return UIComponent.extend("xss.fragment.odata.defaultmodel.Component", { | ||
| metadata: { | ||
| manifest: "json" | ||
| }, | ||
| init: function () { | ||
| UIComponent.prototype.init.apply(this, arguments); | ||
| } | ||
| }); | ||
| }); |
28 changes: 28 additions & 0 deletions
28
.../test/queries/UI5Xss/xss-fragment-odata-default-model/webapp/controller/App.controller.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| sap.ui.define([ | ||
| "sap/ui/core/mvc/Controller", | ||
| "sap/ui/core/Fragment" | ||
| ], function (Controller, Fragment) { | ||
| "use strict"; | ||
|
|
||
| return Controller.extend("xss.fragment.odata.defaultmodel.controller.App", { | ||
| onInit: function () { | ||
| // XSS vulnerability pattern: | ||
| // 1. OData model is configured as default model in manifest.json | ||
| // 2. Fragment is loaded dynamically | ||
| // 3. Fragment is bound to OData entity via bindElement | ||
| // 4. Fragment contains HTML control that renders OData content | ||
|
|
||
| Fragment.load({ | ||
| id: this.getView().getId(), | ||
| name: "xss.fragment.odata.defaultmodel.fragments.DataDisplay", | ||
| controller: this | ||
| }).then(function (oFragment) { | ||
| // Bind fragment to an OData entity - vulnerability is in the backend data | ||
| oFragment.bindElement("/Messages(1)"); | ||
|
|
||
| // Add the fragment to the page content | ||
| this.byId("page").addContent(oFragment); | ||
| }.bind(this)); | ||
| } | ||
| }); | ||
| }); |
9 changes: 9 additions & 0 deletions
9
...queries/UI5Xss/xss-fragment-odata-default-model/webapp/fragments/DataDisplay.fragment.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <core:FragmentDefinition | ||
| xmlns="sap.m" | ||
| xmlns:core="sap.ui.core"> | ||
| <VBox class="sapUiSmallMargin"> | ||
| <Label text="Message from OData:" /> | ||
| <!-- XSS vulnerability: HTML content bound to OData property containing unsanitized data --> | ||
| <core:HTML content="{message}" /> | ||
| </VBox> | ||
| </core:FragmentDefinition> | ||
19 changes: 19 additions & 0 deletions
19
...ipt/frameworks/ui5/test/queries/UI5Xss/xss-fragment-odata-default-model/webapp/index.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <title>XSS Fragment OData Default Model Test</title> | ||
| <script | ||
| id="sap-ui-bootstrap" | ||
| src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" | ||
| data-sap-ui-theme="sap_fiori_3" | ||
| data-sap-ui-resourceroots='{ | ||
| "xss.fragment.odata.defaultmodel": "./" | ||
| }' | ||
| data-sap-ui-oninit="module:xss/fragment/odata/defaultmodel/index" | ||
| data-sap-ui-async="true"> | ||
| </script> | ||
| </head> | ||
| <body class="sapUiBody" id="content"> | ||
| </body> | ||
| </html> |
12 changes: 12 additions & 0 deletions
12
...cript/frameworks/ui5/test/queries/UI5Xss/xss-fragment-odata-default-model/webapp/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| sap.ui.define([ | ||
| "sap/ui/core/ComponentContainer" | ||
| ], function (ComponentContainer) { | ||
| "use strict"; | ||
| new ComponentContainer({ | ||
| name: "xss.fragment.odata.defaultmodel", | ||
| settings: { | ||
| id: "xss.fragment.odata.defaultmodel" | ||
| }, | ||
| async: true | ||
| }).placeAt("content"); | ||
| }); |
48 changes: 48 additions & 0 deletions
48
.../frameworks/ui5/test/queries/UI5Xss/xss-fragment-odata-default-model/webapp/manifest.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| { | ||
| "_version": "1.58.0", | ||
| "sap.app": { | ||
| "id": "xss.fragment.odata.defaultmodel", | ||
| "type": "application", | ||
| "title": "XSS Fragment OData Default Model Test", | ||
| "applicationVersion": { | ||
| "version": "1.0.0" | ||
| }, | ||
| "dataSources": { | ||
| "mainService": { | ||
| "uri": "/odata/v4/catalog/", | ||
| "type": "OData", | ||
| "settings": { | ||
| "odataVersion": "4.0" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "sap.ui": { | ||
| "technology": "UI5", | ||
| "deviceTypes": { | ||
| "desktop": true, | ||
| "tablet": true, | ||
| "phone": true | ||
| } | ||
| }, | ||
| "sap.ui5": { | ||
| "rootView": { | ||
| "viewName": "xss.fragment.odata.defaultmodel.view.App", | ||
| "type": "XML", | ||
| "id": "app" | ||
| }, | ||
| "dependencies": { | ||
| "minUI5Version": "1.60", | ||
| "libs": { | ||
| "sap.m": {} | ||
| } | ||
| }, | ||
| "models": { | ||
| "": { | ||
| "dataSource": "mainService", | ||
| "preload": true, | ||
| "settings": {} | ||
| } | ||
| } | ||
| } | ||
| } |
14 changes: 14 additions & 0 deletions
14
...meworks/ui5/test/queries/UI5Xss/xss-fragment-odata-default-model/webapp/view/App.view.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <mvc:View | ||
| controllerName="xss.fragment.odata.defaultmodel.controller.App" | ||
| xmlns:mvc="sap.ui.core.mvc" | ||
| xmlns="sap.m" | ||
| xmlns:core="sap.ui.core" | ||
| displayBlock="true"> | ||
| <App id="app"> | ||
| <Page id="page" title="XSS Fragment OData Default Model Test"> | ||
| <content> | ||
| <!-- Fragment will be loaded here dynamically --> | ||
| </content> | ||
| </Page> | ||
| </App> | ||
| </mvc:View> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.