From 4bc0eebee0877198cc5072fa8504148bbedc1c73 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Mon, 9 Jan 2023 11:11:33 -0500 Subject: [PATCH] Fix XSS vulnerability in plugin repo pages --- src/controllers/dashboard/plugins/add/index.js | 12 ++++++------ src/controllers/dashboard/plugins/available/index.js | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/controllers/dashboard/plugins/add/index.js b/src/controllers/dashboard/plugins/add/index.js index 1039771a0d..1cd4e0d3c5 100644 --- a/src/controllers/dashboard/plugins/add/index.js +++ b/src/controllers/dashboard/plugins/add/index.js @@ -53,24 +53,24 @@ function renderPackage(pkg, installedPlugins, page) { populateVersions(pkg, page, installedPlugin); populateHistory(pkg, page); - $('.pluginName', page).html(pkg.name); + $('.pluginName', page).text(pkg.name); $('#btnInstallDiv', page).removeClass('hide'); $('#pSelectVersion', page).removeClass('hide'); if (pkg.overview) { - $('#overview', page).show().html(pkg.overview); + $('#overview', page).show().text(pkg.overview); } else { $('#overview', page).hide(); } - $('#description', page).html(pkg.description); - $('#developer', page).html(pkg.owner); + $('#description', page).text(pkg.description); + $('#developer', page).text(pkg.owner); if (installedPlugin) { const currentVersionText = globalize.translate('MessageYouHaveVersionInstalled', '' + installedPlugin.Version + ''); - $('#pCurrentVersion', page).show().html(currentVersionText); + $('#pCurrentVersion', page).show().text(currentVersionText); } else { - $('#pCurrentVersion', page).hide().html(''); + $('#pCurrentVersion', page).hide().text(''); } loading.hide(); diff --git a/src/controllers/dashboard/plugins/available/index.js b/src/controllers/dashboard/plugins/available/index.js index e24d4a144f..656d5bf321 100644 --- a/src/controllers/dashboard/plugins/available/index.js +++ b/src/controllers/dashboard/plugins/available/index.js @@ -1,3 +1,5 @@ +import escapeHTML from 'escape-html'; + import loading from '../../../../components/loading/loading'; import libraryMenu from '../../../../scripts/libraryMenu'; import globalize from '../../../../scripts/globalize'; @@ -73,7 +75,7 @@ function populateList(options) { html += ''; } html += '
'; - html += '

' + category + '

'; + html += '

' + escapeHTML(category) + '

'; html += '