Skip to content

Conversation

@jeongsoolee09
Copy link
Contributor

@jeongsoolee09 jeongsoolee09 commented Nov 19, 2025

What This PR Contributes

Add support for message passing through EventBus, where there are event publishers and ones that subscribe to those events. EventBus is a singleton object that has publish and subscribe methods which are used by the publishers and subscribers, respectively:

  • A publisher publishes a message with optional data through a channel: e.g. EventBus.getInstance().publish("someChannel", "someMessageType", data)
  • A subscriber receives the message (with optional data) through the channel: e.g. EventBus.getInstance().subscribe("someChannel", "someMessageType", function(channel, event, data) { ... }, this). Here, the callback argument handles the message with parameters bound to the message's channel, event, and data.

Note that for a channel and message type pair, there may be multiple subscribers to a publisher, establishing a broadcasting mechanism.

Future Works

UI5PathNode.getAPrimarySource/0 only matches on data binding paths and does not on the optional id property. Doing so enable the same level of rich alert information by incorporating the XML view in the path information, but it requires large-scale rewrite of the library. We leave this as a future work for now.

@@ -0,0 +1 @@
UI5Xss/UI5Xss.ql No newline at end of file

Check warning

Code scanning / CodeQL-Community

Query test without inline test expectations

Query test does not use inline test expectations.
Comment on lines +20 to +23
customController.getAThisNode() = result.getReceiver() and
result.getMethodName() = "getOwnerComponent"
or
exists(TypeTracker t2 | result = getOwnerComponentRef(t2, customController).track(t2, t))

Check warning

Code scanning / CodeQL-Community

Var only used in one side of disjunct.

The [variable t](1) is only used in one side of disjunct.
exists(TypeTracker t2 | result = getOwnerComponentRef(t2, customController).track(t2, t))
}

/* owner component ref */

Check warning

Code scanning / CodeQL-Community

Block comment that is not QLDoc

Block comment could be QLDoc for [the below code](1).
result = getOwnerComponentRef(TypeTracker::end(), customController)
}

private class ObjFieldStep extends SharedTypeTrackingStep {

Check warning

Code scanning / CodeQL-Community

Dead code

This code is never used, and it's not publicly exported.
}
}

private DataFlow::SourceNode getAnAlias(DataFlow::SourceNode object) {

Check warning

Code scanning / CodeQL-Community

Dead code

This code is never used, and it's not publicly exported.
@jeongsoolee09 jeongsoolee09 changed the title Add an XSS example that uses sap/ui/core/EventBus Model sap/ui/core/EventBus Nov 24, 2025
@jeongsoolee09 jeongsoolee09 marked this pull request as ready for review November 24, 2025 19:51
The previously uploaded javascript.sarif.expected file had its
encoding broken and chocked the job. We make it turn back to the
previous version to unblock it.
@data-douser data-douser mentioned this pull request Nov 25, 2025
18 tasks
@mbaluda mbaluda requested a review from Copilot November 25, 2025 22:23
Copilot finished reviewing on behalf of mbaluda November 25, 2025 22:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for modeling message passing through SAP UI5's EventBus API, enabling CodeQL to detect data flow vulnerabilities that traverse the publish-subscribe pattern. The implementation tracks data from EventBus.publish() calls to the corresponding callback parameters in EventBus.subscribe() handlers.

Key Changes

  • Added data flow step connecting published event data to subscription handler parameters
  • Refactored TypeTrackers module into a separate file for better code organization
  • Created comprehensive test case demonstrating XSS vulnerability through EventBus

Reviewed changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ui5.model.yml Adds model definitions for UI5PublishedEventData and UI5EventSubscriptionHandlerDataParameter
FlowSteps.qll Implements PublishedEventToEventSubscribedEventData flow step
TypeTrackers.qll New file containing refactored type tracking predicates
UI5.qll Removes TypeTrackers module and imports it from new location
xss-eventbus-with-data/ Complete test case demonstrating XSS through EventBus publish/subscribe

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@mbaluda mbaluda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Can you add a reference to the new test in ui5/test/README.md?
  • Can you comment what is new in TypeTrackers.qll?

Copy link
Contributor

@mbaluda mbaluda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support the following way of getting an EventBus instance:
this.getOwnerComponent().getEventBus()
sap.ui.getCore().getEventBus()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants