@openui5/sap.ui.support 1.147.0 → 1.147.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openui5/sap.ui.support",
3
- "version": "1.147.0",
3
+ "version": "1.147.1",
4
4
  "description": "OpenUI5 UI Library sap.ui.support",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -14,10 +14,10 @@
14
14
  "url": "https://github.com/UI5/openui5.git"
15
15
  },
16
16
  "dependencies": {
17
- "@openui5/sap.m": "1.147.0",
18
- "@openui5/sap.ui.codeeditor": "1.147.0",
19
- "@openui5/sap.ui.core": "1.147.0",
20
- "@openui5/sap.ui.fl": "1.147.0",
21
- "@openui5/sap.ui.layout": "1.147.0"
17
+ "@openui5/sap.m": "1.147.1",
18
+ "@openui5/sap.ui.codeeditor": "1.147.1",
19
+ "@openui5/sap.ui.core": "1.147.1",
20
+ "@openui5/sap.ui.fl": "1.147.1",
21
+ "@openui5/sap.ui.layout": "1.147.1"
22
22
  }
23
23
  }
@@ -6,7 +6,7 @@
6
6
  <copyright>OpenUI5
7
7
  * (c) Copyright 2026 SAP SE or an SAP affiliate company.
8
8
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.</copyright>
9
- <version>1.147.0</version>
9
+ <version>1.147.1</version>
10
10
 
11
11
  <documentation>UI5 library: sap.ui.support</documentation>
12
12
 
@@ -32,7 +32,7 @@ sap.ui.define([
32
32
  * @namespace
33
33
  * @alias sap.ui.support.RuleAnalyzer
34
34
  * @author SAP SE
35
- * @version 1.147.0
35
+ * @version 1.147.1
36
36
  * @public
37
37
  */
38
38
  var RuleAnalyzer = {
@@ -38,7 +38,7 @@ sap.ui.define(["sap/ui/thirdparty/jquery",
38
38
  * @namespace
39
39
  * @deprecated Since version 1.60.0. Please use sap/ui/support/RuleAnalyzer instead.
40
40
  * @author SAP SE
41
- * @version 1.147.0
41
+ * @version 1.147.1
42
42
  * @public
43
43
  */
44
44
  jQuery.sap.support = {
@@ -23,7 +23,7 @@ sap.ui.define(["sap/ui/core/Lib", "sap/ui/base/DataType", "sap/ui/core/library"]
23
23
  * @namespace
24
24
  * @alias sap.ui.support
25
25
  * @author SAP SE
26
- * @version 1.147.0
26
+ * @version 1.147.1
27
27
  * @since 1.50
28
28
  * @public
29
29
  */
@@ -38,7 +38,7 @@ sap.ui.define(["sap/ui/core/Lib", "sap/ui/base/DataType", "sap/ui/core/library"]
38
38
  controls: [],
39
39
  elements: [],
40
40
  noLibraryCSS: true,
41
- version: "1.147.0",
41
+ version: "1.147.1",
42
42
  extensions: {
43
43
  //Configuration used for rule loading of Support Assistant
44
44
  "sap.ui.support": {
@@ -34,7 +34,7 @@ function (Log, Version, library, storage) {
34
34
  * @private
35
35
  * @alias sap.ui.support.RuleSet
36
36
  * @author SAP SE
37
- * @version 1.147.0
37
+ * @version 1.147.1
38
38
  * @param {object} oSettings Name of the initiated
39
39
  */
40
40
  var RuleSet = function (oSettings) {
@@ -53,7 +53,7 @@ sap.ui.define([
53
53
  *
54
54
  * @name sap.ui.support.Storage
55
55
  * @author SAP SE.
56
- * @version 1.147.0
56
+ * @version 1.147.1
57
57
  * @private
58
58
  */
59
59
  return /** @lends sap.ui.support.Storage */ {
@@ -24,7 +24,7 @@ sap.ui.define([
24
24
  * @class
25
25
  * @alias sap.ui.support.WindowCommunicationBus
26
26
  * @author SAP SE
27
- * @version 1.147.0
27
+ * @version 1.147.1
28
28
  * @private
29
29
  */
30
30
  var WindowCommunicationBus = BaseObject.extend("sap.ui.support.supportRules.WindowCommunicationBus", {
@@ -127,37 +127,78 @@ sap.ui.define([
127
127
  };
128
128
 
129
129
  /**
130
- * validate messages published from external window to application window (i.e. from tool frame to opener window)
131
- * no validation needed the other way (i.e. from opener window to tool frame)
130
+ * Compare the origins of two URLs. Returns false if either value is not a valid URL.
131
+ * @private
132
+ * @param {string} sOriginA First URL string
133
+ * @param {string} sOriginB Second URL string
134
+ * @returns {boolean} true if both URLs have the same origin
135
+ */
136
+ WindowCommunicationBus._compareOrigins = function (sOriginA, sOriginB) {
137
+ try {
138
+ return new URL(sOriginA).origin === new URL(sOriginB).origin;
139
+ } catch (e) {
140
+ return false;
141
+ }
142
+ };
143
+
144
+ /**
145
+ * Validate messages received from external windows.
146
+ * Both directions are validated:
147
+ * - Tool frame: validates origin of messages from opener window
148
+ * - Application window: validates origin, frame identifier, and URL path of messages from tool frame
132
149
  * @private
133
150
  * @param {EventListener} eMessage Event fired by the channels attached to the WindowCommunicationBus
134
151
  * @returns {boolean} true if the message is valid
135
152
  */
136
153
  WindowCommunicationBus.prototype._validate = function (eMessage) {
154
+ // 1. Validate origin
155
+ // tool frame: validate against the configured opener origin
137
156
  if (isEmptyObject(this._frame)) {
138
- // there are no channels associated with this bus, or
139
- // when loaded in a tool frame, the CommumnicationBus class will always have an empty 'frame' object.
140
- // in this case, a message is sent from the opener to the tool frame and no validation is necessary
157
+ const sExpectedOrigin = this._oConfig.getOrigin();
158
+
159
+ if (sExpectedOrigin) {
160
+ return WindowCommunicationBus._compareOrigins(eMessage.origin, sExpectedOrigin);
161
+ }
162
+
141
163
  return true;
142
164
  }
143
165
 
144
- // when a message is sent from a tool frame to the application (opener) window,
145
- // the message should have the correct details, validating that it comes from a known tool frame
166
+ // application window: validate against the known tool frame origin
167
+ if (!WindowCommunicationBus._compareOrigins(eMessage.origin, this._frame.origin)) {
168
+ return false;
169
+ }
146
170
 
147
- // check if the frame ID (number represented as string) is the same
148
- var bMatchIdentifier = eMessage.data._frameIdentifier === this._frame.identifier;
171
+ // 2. Validate frame identifier
172
+ if (eMessage.data._frameIdentifier !== this._frame.identifier) {
173
+ return false;
174
+ }
149
175
 
150
- // check if the URL matches: 1. check if the domain name matches - should be case insensitive
151
- var oOriginRegExp = new RegExp("^" + this._frame.origin + "$", "i");
152
- var bMatchOrigin = oOriginRegExp.exec(eMessage.origin);
176
+ // 3. Validate URL path
177
+ // Compare parsed pathnames to avoid substring-matching attacks.
178
+ // The frame URL may be absolute or relative — strip query string and relative segments
179
+ // to extract the path portion, then verify the message origin's pathname ends with it.
180
+ try {
181
+ const oOriginUrl = new URL(eMessage.data._origin);
182
+ const iFrameUrlQuery = this._frame.url.indexOf("?");
183
+ const sFrameUrlWithoutQuery = this._frame.url.substring(0, iFrameUrlQuery).replace(/\.\.\//g, "").replace(/\.\//g, "");
184
+
185
+ // extract just the pathname: parse as URL if absolute, otherwise use the cleaned string as-is
186
+ let sFramePath;
187
+ try {
188
+ sFramePath = new URL(sFrameUrlWithoutQuery).pathname;
189
+ } catch (e) {
190
+ // relative URL — use cleaned string directly as a path suffix
191
+ sFramePath = sFrameUrlWithoutQuery;
192
+ }
153
193
 
154
- // check if the URL matches: 2. check if the path to the iframe matches.
155
- // if the frame URL is relative to the parent window's URL, remove relative path segments
156
- var iFrameUrlQuery = this._frame.url.indexOf("?");
157
- var sFrameUrl = this._frame.url.substr(0, iFrameUrlQuery).replace(/\.\.\//g, "").replace(/\.\//g, "") + this._frame.url.substr(iFrameUrlQuery);
158
- var bMatchUrl = eMessage.data._origin.indexOf(sFrameUrl) > -1;
194
+ if (!oOriginUrl.pathname.endsWith(sFramePath)) {
195
+ return false;
196
+ }
197
+ } catch (e) {
198
+ return false;
199
+ }
159
200
 
160
- return bMatchIdentifier && bMatchOrigin && bMatchUrl;
201
+ return true;
161
202
  };
162
203
 
163
204
  WindowCommunicationBus.prototype._getFrameIdentifier = function () {
@@ -93,7 +93,7 @@ sap.ui.define([
93
93
  *
94
94
  * @extends sap.ui.support.supportRules.ui.controllers.BaseController
95
95
  * @author SAP SE
96
- * @version 1.147.0
96
+ * @version 1.147.1
97
97
  * @private
98
98
  * @alias sap.ui.support.supportRules.ui.controllers.PresetsController
99
99
  */
@@ -1,4 +1,4 @@
1
- /* eslint-disable no-eval */
1
+ /* eslint-disable no-new-func */
2
2
 
3
3
  /*!
4
4
  * OpenUI5
@@ -9,11 +9,12 @@
9
9
  sap.ui.define([], function () {
10
10
  "use strict";
11
11
 
12
- var bIsEvalAllowed;
12
+ let bIsEvalAllowed;
13
13
 
14
- // Checks if eval can be used in the current platform (based on CSP restrictions)
14
+ // Checks if the Function constructor can be used in the current platform (based on CSP restrictions)
15
15
  try {
16
- eval("");
16
+ // eslint-disable-next-line no-new
17
+ new Function("");
17
18
  bIsEvalAllowed = true;
18
19
  } catch (e) {
19
20
  bIsEvalAllowed = false;
@@ -34,11 +35,7 @@ sap.ui.define([], function () {
34
35
  * @throws Error why eval failed, for example invalid syntax
35
36
  */
36
37
  evalFunction: function (sFunction) {
37
- var fn;
38
-
39
- eval("fn = " + sFunction);
40
-
41
- return fn;
38
+ return new Function("return (" + sFunction + ")")();
42
39
  }
43
40
  };
44
- });
41
+ });