Skip to content

Model manifest-created UI5 client data models - #447

Closed
mbaluda wants to merge 27 commits into
mainfrom
mbaluda/fp-manifest-models
Closed

mbaluda wants to merge 27 commits into
mainfrom
mbaluda/fp-manifest-models

Conversation

@mbaluda

@mbaluda mbaluda commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

What This PR Contributes

  • Models default UI5 client data models created from manifest.json:
    • Recognizes explicitly declared sap.ui.model.json.JSONModel instances.
    • Infers JSON model types from referenced JSON data sources through MaD client-data-model types.
    • Associates each model with the nearest owning UI5 component, including standalone and nested components.
  • Tracks path-specific, bidirectional model flow through declarative bindings:
    • Resolves relative paths through nested items binding contexts.
    • Keeps unrelated model paths separate to avoid false-positive flows.
    • Honors setDefaultBindingMode(BindingMode.OneWay) and component, view, control, and ancestor-control model overrides.
    • Represents bindings in .view.json files with synthesized data-flow nodes, enabling manifest-backed Input-to-HTML XSS flows in JSON views.
  • Reorganizes UI5 model support into focused libraries:
    • UI5DataModels.qll owns model references, concrete JSON/XML/resource/OData models, manifest model declarations, binding modes, and binding-path resolution.
    • JsonBindingTarget.qll provides local-overlay data-flow nodes for JSON-view property bindings.
    • UI5.qll, UI5View.qll, and RemoteFlowSources.qll retain their component, view, and remote-source responsibilities.
  • Adds focused regression coverage for manifest-created models in XML and JSON views, nested components, overrides, one-way binding, and path isolation.
  • Demonstrates the detected XSS flows in code scanning:

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mbaluda
mbaluda requested a balanced review from Copilot October 1, 2026 19:13
@mbaluda mbaluda self-assigned this Oct 1, 2026

This comment was marked as resolved.

mbaluda and others added 2 commits October 1, 2026 21:28
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This comment was marked as resolved.

This comment was marked as resolved.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This comment was marked as resolved.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This comment was marked as resolved.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mbaluda
mbaluda added this pull request to stack #449 October 2, 2026 12:19

This comment was marked as resolved.

Require typed JSON controls, accept literal binding modes, and resolve the nearest control, view, or component model assignment.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove cross-controller model-binding edges after resolving each binding against its owning model.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This comment was marked as resolved.

Route repeated bindings through one canonical component/path hub and add a regression that enumerates each hub once.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 2, 2026 15:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

One-way flow edges are reversed, and JSON bindings can misclassify unrelated properties as XSS sources or sinks.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity

Open (2)

Propagate model content to controls for all bindings and allow control-to-model flow only for two-way modes, using a non-source canonical hub.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 2, 2026 15:45
Require JSON-view source and sink bindings to target the specific modeled member, with tooltip and visible false-positive coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Manifest model references, inherited binding modes, real JSONView aggregation bindings, and JSON-control locations remain incorrectly modeled.

Review effort: Balanced
Findings: None

Resolved since last review (2)
Previously missed (4)

In code that hasn't changed since last review

Medium severity Resolve default manifest model references for imperative property access

javascript/​frameworks/​ui5/​lib/​advanced_security/​javascript/​frameworks/​ui5/​UI5DataModels.qll:45

Default manifest-model references cannot pass this predicate: getModel() has no model name, and getResolvedModel() only follows an explicit setModel call. The existing LocalModelSetPropertyStep/LocalModelGetPropertyStep therefore skip calls such as this.getView().getModel().setProperty("/value", input) for the newly modeled auto-created model, so imperative reads/writes never connect to its declarative bindings. Resolve unmatched default references to the owning DefaultManifestJsonModel and add path-specific flow steps and regression cases for setProperty and getProperty.

Medium severity Resolve inherited control models before applying binding mode changes

javascript/​frameworks/​ui5/​lib/​advanced_security/​javascript/​frameworks/​ui5/​UI5DataModels.qll:430

Checking only for a setModel call on the exact receiver misclassifies inherited control models. For example, if an ancestor control has a local model, this.byId("child").getModel().setDefaultBindingMode(OneWay) changes that inherited local model, but this predicate associates the call with the manifest model and can disable two-way flow for unrelated manifest bindings elsewhere in the component. Resolve the reference through the same control/view/component hierarchy used by resolveModel before applying its binding mode.

Medium severity Support object-form JSONView aggregation bindings

javascript/​frameworks/​ui5/​lib/​advanced_security/​javascript/​frameworks/​ui5/​UI5View.qll:176

This only recognizes an items property whose value is directly a binding string. A real JSONView aggregation binding is object-shaped (for example, "items": { "path": "/groups", "template": { ... } }), so Bindings.qll creates no JsonBindingPath for items and descendants in the template never acquire the collection context. The added fixture masks this by using a nonstandard string items property with controls in a separate content array. Support object-form aggregation bindings and test with a valid path/template JSONView so nested relative paths work in deployed applications.

Medium severity Fix reversed location parameter order in UI5Control.hasLocationInfo

javascript/​frameworks/​ui5/​test/​models/​json_controls/​jsonControlTest.expected:2

These expected locations have line and column positions swapped: the outer object spans 4:5–14:5, and the nested object spans 9:19–12:9 (the file has only 16 lines, so 19:9–9:12 cannot be valid). This exposes the reversed integer parameters in UI5Control.hasLocationInfo; accepting these results preserves incorrect locations for JSON controls and downstream alerts. Change that predicate to the standard (startline, startcolumn, endline, endcolumn) order and regenerate this expected file.

Copilot AI balanced review requested due to automatic review settings October 2, 2026 15:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

JavaScript-view control model overrides are omitted from the new model hierarchy resolution.

Review effort: Balanced
Findings: None

Previously missed (1)

In code that hasn't changed since last review

Medium severity Include JavaScript-view controls in model resolution hierarchy

javascript/​frameworks/​ui5/​lib/​advanced_security/​javascript/​frameworks/​ui5/​UI5DataModels.qll:865

JavaScript-view controls are omitted from this hierarchy. JsViewBindingPath.getControlDeclaration() returns an asJsControl(), so a setModel(...) on that control is never considered by getControlSetModelCall or hasDefaultModelOverride; bindings can therefore resolve to a view/component/manifest model instead of the closer control model. Include the JS control itself here (and any representable JS-control ancestry).

Recognize positional JavaScript control IDs and include the JS control itself when selecting the nearest setModel assignment.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 2, 2026 16:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Root-array path joining and binding-level mode overrides can currently produce incorrect XSS flow results.

Review effort: Balanced
Findings: None

Previously missed (2)

In code that hasn't changed since last review

Medium severity Avoid double slash when resolving relative paths from root arrays

javascript/​frameworks/​ui5/​lib/​advanced_security/​javascript/​frameworks/​ui5/​UI5View.qll:55

A valid root-array aggregation uses items="{/}". For a relative child such as {value}, this concatenation produces //value instead of /value, so path-specific model flow no longer matches other bindings to the same runtime property. Normalize the separator when the enclosing absolute path is /.

Medium severity Honor effective binding mode for reverse edges and source classification

javascript/​frameworks/​ui5/​lib/​advanced_security/​javascript/​frameworks/​ui5/​dataflow/​FlowSteps.qll:18

This reverse edge uses only the model's default mode. A property binding can explicitly set mode: 'OneWay' or OneTime, overriding a TwoWay model; such a binding is still connected back to the model here and is also classified as a remote source in RemoteFlowSources.qll, producing false-positive XSS flow. Compute the effective mode per binding and apply it both here and when classifying source controls.

@mbaluda mbaluda closed this Oct 3, 2026
@mbaluda
mbaluda deleted the mbaluda/fp-manifest-models branch October 4, 2026 10:10
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