Skip to content

Commit 9305d1a

Browse files
author
Dave Conway-Jones
committed
Fix ui_text XSS
to close #772
1 parent 672f748 commit 9305d1a

File tree

5 files changed

+46
-12
lines changed

5 files changed

+46
-12
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11

2+
### 3.1.9: Maintenance Release
3+
4+
- Fix Cross site scripting for ui_text format input. Issue #772
5+
26
### 3.1.8: Maintenance Release
37

48
- Use Node-RED CSS vars for ui-bas to help themeing. PR #763

dist/dashboard.appcache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CACHE MANIFEST
2-
# Time: Wed May 25 2022 11:23:30 GMT+0100 (British Summer Time)
2+
# Time: Wed Aug 24 2022 17:30:31 GMT+0100 (British Summer Time)
33

44
CACHE:
55
i18n.js
@@ -26,4 +26,4 @@ loading.html
2626
NETWORK:
2727
*
2828

29-
# hash: 22f744c7102e4eb0375d482c7bd34ac0d407159d34773e84e1f5087d0b6444d3
29+
# hash: 9ff936fabba7ec5170a4f63f8f6b72aa1343c36c57f8382848eb81dae9ca5512

dist/js/app.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-dashboard",
3-
"version": "3.1.8",
3+
"version": "3.1.9",
44
"description": "A set of dashboard nodes for Node-RED",
55
"keywords": [
66
"node-red"

src/components/ui-component/ui-component-ctrl.js

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,58 @@ angular.module('ui').controller('uiComponentController', ['$scope', 'UiEvents',
1212
var me = this;
1313

1414
if (typeof me.item.format === "string") {
15-
me.item.getText = $interpolate(me.item.format).bind(null, me.item);
15+
if (me.item.format.indexOf("constructor") === -1) {
16+
me.item.getText = $interpolate(me.item.format).bind(null, me.item);
17+
}
18+
else {
19+
me.item.getText = function() { return me.item.format };
20+
}
1621
}
1722

1823
if (typeof me.item.label === "string") {
19-
me.item.getLabel = $interpolate(me.item.label).bind(null, me.item);
20-
me.item.safeLabel = "nr-dashboard-widget-" + (me.item.label).replace(/\W/g,'_');
24+
if (me.item.label.indexOf("constructor") === -1) {
25+
me.item.getLabel = $interpolate(me.item.label).bind(null, me.item);
26+
me.item.safeLabel = "nr-dashboard-widget-" + (me.item.label).replace(/\W/g,'_');
27+
}
28+
else {
29+
me.item.getText = function() { return me.item.label };
30+
}
2131
}
2232

2333
if (typeof me.item.tooltip === "string") {
24-
me.item.getTooltip = $interpolate(me.item.tooltip).bind(null, me.item);
34+
if (me.item.tooltip.indexOf("constructor") === -1) {
35+
me.item.getTooltip = $interpolate(me.item.tooltip).bind(null, me.item);
36+
}
37+
else {
38+
me.item.getText = function() { return me.item.tooltip };
39+
}
2540
}
2641

2742
if (typeof me.item.color === "string") {
28-
me.item.getColor = $interpolate(me.item.color).bind(null, me.item);
43+
if (me.item.color.indexOf("constructor") === -1) {
44+
me.item.getColor = $interpolate(me.item.color).bind(null, me.item);
45+
}
46+
else {
47+
me.item.getText = function() { return me.item.color };
48+
}
2949
}
3050

3151
if (typeof me.item.icon === "string") {
32-
me.item.getIcon = $interpolate(me.item.icon).bind(null, me.item);
52+
if (me.item.icon.indexOf("constructor") === -1) {
53+
me.item.getIcon = $interpolate(me.item.icon).bind(null, me.item);
54+
}
55+
else {
56+
me.item.getText = function() { return me.item.icon };
57+
}
3358
}
3459

3560
if (typeof me.item.units === "string") {
36-
me.item.getUnits = $interpolate(me.item.units).bind(null, me.item);
61+
if (me.item.units.indexOf("constructor") === -1) {
62+
me.item.getUnits = $interpolate(me.item.units).bind(null, me.item);
63+
}
64+
else {
65+
me.item.getText = function() { return me.item.units };
66+
}
3767
}
3868

3969
me.init = function () {

0 commit comments

Comments
 (0)