Improve UI5Xss detection for fragments_samples 1 #281
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.
Purpose
Proposes changes to the
UI5Xss.qlquery implementation and associated unit tests in order to better detect provided UI5 XSS vulnerabilities as initially demonstrated infragments_samplesapps. This PR also builds on the philosophy of using MaD wherever possible, in accordance with #277 .Summary of Changes
This pull request enhances the UI5 static analysis by adding support for recognizing and tracking the usage of the static
Fragment.byId(viewId, controlId)pattern for control references. It also introduces a new test case to verify detection of XSS vulnerabilities involving this pattern. The changes improve the accuracy of control resolution in UI5 codebases and ensure security queries can detect vulnerabilities in more real-world scenarios.Framework enhancements:
FragmentModuleclass inUI5.qllto model static imports of thesap/ui/core/Fragmentmodule, enabling tracking of staticFragment.byId()calls.ControlReferencelogic inUI5.qllto recognize both standard and staticFragment.byId(viewId, controlId)usages, extracting the correct control ID argument for both cases. [1] [2]UI5Control.getAReference()method inUI5View.qllto support matching controls referenced via either standard or staticbyIdcalls, handling the different argument positions.Fragment.byId()API for control resolution.Testing improvements:
xss-fragment-static-byid) with a sample UI5 application demonstrating an XSS vulnerability viaFragment.byId(), including all supporting files, expected results, and configuration. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]