From e6b8a379ba6939b4016b191fce916ebc68c5bc2c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 26 Apr 2021 14:54:55 +0300 Subject: [PATCH] Fix vulnerability --- apps/common/main/lib/component/TreeView.js | 4 ++-- apps/documenteditor/main/app/view/BookmarksDialog.js | 2 +- apps/documenteditor/main/app/view/ControlSettingsDialog.js | 4 ++-- apps/documenteditor/main/app/view/CrossReferenceDialog.js | 2 +- apps/documenteditor/main/app/view/DocumentHolder.js | 7 ++++++- apps/documenteditor/main/app/view/FormSettings.js | 2 +- apps/spreadsheeteditor/main/app/controller/ViewTab.js | 7 ++++++- apps/spreadsheeteditor/main/app/view/NameManagerDlg.js | 2 +- apps/spreadsheeteditor/main/app/view/NamedRangePasteDlg.js | 2 +- apps/spreadsheeteditor/main/app/view/ViewManagerDlg.js | 2 +- 10 files changed, 22 insertions(+), 12 deletions(-) diff --git a/apps/common/main/lib/component/TreeView.js b/apps/common/main/lib/component/TreeView.js index b8016b431..84c3fe860 100644 --- a/apps/common/main/lib/component/TreeView.js +++ b/apps/common/main/lib/component/TreeView.js @@ -176,11 +176,11 @@ define([ '
', '<% } %>', '<% if (isNotHeader) { %>', - '
<%= name %>
', + '
<%= Common.Utils.String.htmlEncode(name) %>
', '<% } else if (isEmptyItem) { %>', '
' + options.emptyItemText + '
', '<% } else { %>', - '
<%= name %>
', + '
<%= Common.Utils.String.htmlEncode(name) %>
', '<% } %>', '' ].join('')); diff --git a/apps/documenteditor/main/app/view/BookmarksDialog.js b/apps/documenteditor/main/app/view/BookmarksDialog.js index d6d305194..b03ab95f8 100644 --- a/apps/documenteditor/main/app/view/BookmarksDialog.js +++ b/apps/documenteditor/main/app/view/BookmarksDialog.js @@ -174,7 +174,7 @@ define([ el: $('#bookmarks-list', this.$window), store: new Common.UI.DataViewStore(), tabindex: 1, - itemTemplate: _.template('
<%= value %>
') + itemTemplate: _.template('
<%= Common.Utils.String.htmlEncode(value) %>
') }); this.bookmarksList.store.comparator = function(rec) { return (me.radioName.getValue() ? rec.get("value") : rec.get("location")); diff --git a/apps/documenteditor/main/app/view/ControlSettingsDialog.js b/apps/documenteditor/main/app/view/ControlSettingsDialog.js index b8c0b4b02..c921e816b 100644 --- a/apps/documenteditor/main/app/view/ControlSettingsDialog.js +++ b/apps/documenteditor/main/app/view/ControlSettingsDialog.js @@ -168,8 +168,8 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template', template: _.template(['
'].join('')), itemTemplate: _.template([ '
', - '
<%= name %>
', - '
<%= value %>
', + '
<%= Common.Utils.String.htmlEncode(name) %>
', + '
<%= Common.Utils.String.htmlEncode(value) %>
', '
' ].join('')), tabindex: 1 diff --git a/apps/documenteditor/main/app/view/CrossReferenceDialog.js b/apps/documenteditor/main/app/view/CrossReferenceDialog.js index f2a436813..e5934cf3b 100644 --- a/apps/documenteditor/main/app/view/CrossReferenceDialog.js +++ b/apps/documenteditor/main/app/view/CrossReferenceDialog.js @@ -183,7 +183,7 @@ define([ this.refList = new Common.UI.ListView({ el: $window.find('#id-dlg-cross-list'), store: new Common.UI.DataViewStore(), - itemTemplate: _.template('
<%= value %>
') + itemTemplate: _.template('
<%= Common.Utils.String.htmlEncode(value) %>
') }); this.refList.on('entervalue', _.bind(this.onPrimary, this)) .on('item:dblclick', _.bind(this.onPrimary, this)); diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index a5ac92070..68e9a89e2 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -4319,7 +4319,12 @@ define([ for (var i=0; i', + '<%= Common.Utils.String.htmlEncode(caption) %>', + '' + ].join('')) })); } if (!isForm && menu.items.length<1) { diff --git a/apps/documenteditor/main/app/view/FormSettings.js b/apps/documenteditor/main/app/view/FormSettings.js index c5da9f278..443f84bf2 100644 --- a/apps/documenteditor/main/app/view/FormSettings.js +++ b/apps/documenteditor/main/app/view/FormSettings.js @@ -224,7 +224,7 @@ define([ itemTemplate: _.template([ '
', // '
<%= name %>
', - '
<%= name %>
', + '
<%= Common.Utils.String.htmlEncode(name) %>
', '
' ].join('')) }); diff --git a/apps/spreadsheeteditor/main/app/controller/ViewTab.js b/apps/spreadsheeteditor/main/app/controller/ViewTab.js index b4c07e636..80c9e29a4 100644 --- a/apps/spreadsheeteditor/main/app/controller/ViewTab.js +++ b/apps/spreadsheeteditor/main/app/controller/ViewTab.js @@ -156,7 +156,12 @@ define([ caption : item.asc_getName(), checkable: true, allowDepress: false, - checked : item.asc_getIsActive() + checked : item.asc_getIsActive(), + template : _.template([ + '', + '<%= Common.Utils.String.htmlEncode(caption) %>', + '' + ].join('')) })); if (item.asc_getIsActive()) active = true; diff --git a/apps/spreadsheeteditor/main/app/view/NameManagerDlg.js b/apps/spreadsheeteditor/main/app/view/NameManagerDlg.js index 9229ea8d9..e5989db39 100644 --- a/apps/spreadsheeteditor/main/app/view/NameManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/NameManagerDlg.js @@ -123,7 +123,7 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template', itemTemplate: _.template([ '
', '
">
', - '
<%= name %>
', + '
<%= Common.Utils.String.htmlEncode(name) %>
', '
<%= scopeName %>
', '
<%= range %>
', '<% if (lock) { %>', diff --git a/apps/spreadsheeteditor/main/app/view/NamedRangePasteDlg.js b/apps/spreadsheeteditor/main/app/view/NamedRangePasteDlg.js index a977ac207..50fc84325 100644 --- a/apps/spreadsheeteditor/main/app/view/NamedRangePasteDlg.js +++ b/apps/spreadsheeteditor/main/app/view/NamedRangePasteDlg.js @@ -95,7 +95,7 @@ define([ '
', '
', '
">
', - '
<%= name %>
', + '
<%= Common.Utils.String.htmlEncode(name) %>
', '
', '
' ].join('')) diff --git a/apps/spreadsheeteditor/main/app/view/ViewManagerDlg.js b/apps/spreadsheeteditor/main/app/view/ViewManagerDlg.js index d41d1b08b..f606e72ec 100644 --- a/apps/spreadsheeteditor/main/app/view/ViewManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/ViewManagerDlg.js @@ -118,7 +118,7 @@ define([ template: _.template(['
'].join('')), itemTemplate: _.template([ '
', - '
<%= name %>
', + '
<%= Common.Utils.String.htmlEncode(name) %>
', '<% if (lock) { %>', '
<%=lockuser%>
', '<% } %>',