all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Friedrich Weber <f.weber@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 2/2] ui: add some missing `htmlEncode`s
Date: Tue, 25 Jul 2023 13:52:46 +0200	[thread overview]
Message-ID: <20230725115246.192646-3-f.weber@proxmox.com> (raw)
In-Reply-To: <20230725115246.192646-1-f.weber@proxmox.com>

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
---
 www/manager6/Utils.js               | 9 ++++++---
 www/manager6/dc/BackupJobDetail.js  | 1 +
 www/manager6/dc/PCIMapView.js       | 2 +-
 www/manager6/dc/USBMapView.js       | 2 +-
 www/manager6/form/PCIMapSelector.js | 1 +
 www/manager6/form/USBMapSelector.js | 1 +
 www/manager6/qemu/CloudInit.js      | 4 ++--
 7 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index a150e848..4e094213 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1003,15 +1003,18 @@ Ext.define('PVE.Utils', {
     },
 
     render_storage_content: function(value, metaData, record) {
-	var data = record.data;
+	let data = record.data;
+	let result;
 	if (Ext.isNumber(data.channel) &&
 	    Ext.isNumber(data.id) &&
 	    Ext.isNumber(data.lun)) {
-	    return "CH " +
+	    result = "CH " +
 		Ext.String.leftPad(data.channel, 2, '0') +
 		" ID " + data.id + " LUN " + data.lun;
+	} else {
+	    result = data.volid.replace(/^.*?:(.*?\/)?/, '');
 	}
-	return data.volid.replace(/^.*?:(.*?\/)?/, '');
+	return Ext.String.htmlEncode(result);
     },
 
     render_serverity: function(value) {
diff --git a/www/manager6/dc/BackupJobDetail.js b/www/manager6/dc/BackupJobDetail.js
index c4683a47..880784a2 100644
--- a/www/manager6/dc/BackupJobDetail.js
+++ b/www/manager6/dc/BackupJobDetail.js
@@ -249,6 +249,7 @@ Ext.define('PVE.dc.BackupInfo', {
 	    xtype: 'displayfield',
 	    name: 'comment',
 	    fieldLabel: gettext('Comment'),
+	    renderer: Ext.String.htmlEncode,
 	},
 	{
 	    xtype: 'fieldset',
diff --git a/www/manager6/dc/PCIMapView.js b/www/manager6/dc/PCIMapView.js
index 859ef58f..80fe3c0f 100644
--- a/www/manager6/dc/PCIMapView.js
+++ b/www/manager6/dc/PCIMapView.js
@@ -98,7 +98,7 @@ Ext.define('PVE.dc.PCIMapView', {
 	    header: gettext('Comment'),
 	    dataIndex: 'description',
 	    renderer: function(value, _meta, record) {
-		return value ?? record.data.comment;
+		return Ext.String.htmlEncode(value ?? record.data.comment);
 	    },
 	    flex: 1,
 	},
diff --git a/www/manager6/dc/USBMapView.js b/www/manager6/dc/USBMapView.js
index 953e2425..96edc587 100644
--- a/www/manager6/dc/USBMapView.js
+++ b/www/manager6/dc/USBMapView.js
@@ -90,7 +90,7 @@ Ext.define('PVE.dc.USBMapView', {
 	    header: gettext('Comment'),
 	    dataIndex: 'description',
 	    renderer: function(value, _meta, record) {
-		return value ?? record.data.comment;
+		return Ext.String.htmlEncode(value ?? record.data.comment);
 	    },
 	    flex: 1,
 	},
diff --git a/www/manager6/form/PCIMapSelector.js b/www/manager6/form/PCIMapSelector.js
index 1bc73ec0..49629bc2 100644
--- a/www/manager6/form/PCIMapSelector.js
+++ b/www/manager6/form/PCIMapSelector.js
@@ -40,6 +40,7 @@ Ext.define('PVE.form.PCIMapSelector', {
 		header: gettext('Description'),
 		dataIndex: 'description',
 		flex: 1,
+		renderer: Ext.String.htmlEncode,
 	    },
 	    {
 		header: gettext('Status'),
diff --git a/www/manager6/form/USBMapSelector.js b/www/manager6/form/USBMapSelector.js
index 6a33754a..2e55c100 100644
--- a/www/manager6/form/USBMapSelector.js
+++ b/www/manager6/form/USBMapSelector.js
@@ -64,6 +64,7 @@ Ext.define('PVE.form.USBMapSelector', {
 		header: gettext('Comment'),
 		dataIndex: 'description',
 		flex: 1,
+		renderer: Ext.String.htmlEncode,
 	    },
 	],
     },
diff --git a/www/manager6/qemu/CloudInit.js b/www/manager6/qemu/CloudInit.js
index 03d06d9c..49519726 100644
--- a/www/manager6/qemu/CloudInit.js
+++ b/www/manager6/qemu/CloudInit.js
@@ -214,7 +214,7 @@ Ext.define('PVE.qemu.CloudInit', {
 		    ],
 		} : undefined,
 		renderer: function(value) {
-		    return value || Proxmox.Utils.defaultText;
+		    return Ext.String.htmlEncode(value || Proxmox.Utils.defaultText);
 		},
 	    },
 	    cipassword: {
@@ -236,7 +236,7 @@ Ext.define('PVE.qemu.CloudInit', {
 		    ],
 		} : undefined,
 		renderer: function(value) {
-		    return value || Proxmox.Utils.noneText;
+		    return Ext.String.htmlEncode(value || Proxmox.Utils.noneText);
 		},
 	    },
 	    searchdomain: {
-- 
2.39.2





  parent reply	other threads:[~2023-07-25 11:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25 11:52 [pve-devel] [PATCH widget-toolkit/manager 0/2] " Friedrich Weber
2023-07-25 11:52 ` [pve-devel] [PATCH widget-toolkit 1/2] " Friedrich Weber
2023-07-25 11:52 ` Friedrich Weber [this message]
2023-07-25 15:00 ` [pve-devel] applied-series: [PATCH widget-toolkit/manager 0/2] " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230725115246.192646-3-f.weber@proxmox.com \
    --to=f.weber@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal