From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <f.weber@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 82EFBFEF6
 for <pve-devel@lists.proxmox.com>; Tue, 25 Jul 2023 13:53:00 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 6547D19FE0
 for <pve-devel@lists.proxmox.com>; Tue, 25 Jul 2023 13:53:00 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pve-devel@lists.proxmox.com>; Tue, 25 Jul 2023 13:52:59 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 8395043CB0
 for <pve-devel@lists.proxmox.com>; Tue, 25 Jul 2023 13:52:59 +0200 (CEST)
From: Friedrich Weber <f.weber@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Tue, 25 Jul 2023 13:52:46 +0200
Message-Id: <20230725115246.192646-3-f.weber@proxmox.com>
X-Mailer: git-send-email 2.39.2
In-Reply-To: <20230725115246.192646-1-f.weber@proxmox.com>
References: <20230725115246.192646-1-f.weber@proxmox.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.238 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 T_SCC_BODY_TEXT_LINE    -0.01 -
Subject: [pve-devel] [PATCH manager 2/2] ui: add some missing `htmlEncode`s
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Tue, 25 Jul 2023 11:53:00 -0000

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