Improve UI5Xss.ql query to detect default OData model with bindElement
#283
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.
What This PR Contributes
This pull request improves the detection of XSS vulnerabilities in SAP UI5 applications by enhancing the binding analysis logic and adding a comprehensive test case for scenarios involving fragments and default OData models. The main changes include refining how context bindings via
bindElementare tracked, updating the logic for identifying default model usage, and introducing a new test suite to validate the detection of XSS in this context.Outline of Changes
Key improvements include:
Improvements to OData Default Model Binding Detection:
getBindElementCall()to theBindingclass to accurately retrieve thebindElementmethod call node for context bindings.asBinding()method inDefaultODataServiceModelto match context bindings whosebindElementcall is this node, improving the association between the model and its bindings.UI5BindingPathto only considersetModelcalls within the same webapp, preventing false associations with unrelated models.New Test Case for XSS Vulnerability:
xss-fragment-odata-default-model) demonstrating an XSS vulnerability when a fragment is bound to an OData entity via the default model and displays unsanitized data. This includes all necessary configuration, controller, fragment, and manifest files. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]