diff --git a/front/deviceDetails.php b/front/deviceDetails.php index 9d3db549..05067264 100755 --- a/front/deviceDetails.php +++ b/front/deviceDetails.php @@ -517,11 +517,11 @@ function applyDevicePageTitle(mac, name, owner) { ); $('#devicePageInfoPlc').show(); } else if (!owner || (name && name.toString().includes(owner))) { - pageTitleText = name ?? getString("DevDetail_EveandAl_NewDevice"); + pageTitleText = encodeSpecialChars(name ?? getString("DevDetail_EveandAl_NewDevice")); $('#pageTitle').html(pageTitleText); $('#devicePageInfoPlc').hide(); } else { - pageTitleText = `${name ?? getString("DevDetail_EveandAl_NewDevice")} (${owner})`; + pageTitleText = `${encodeSpecialChars(name ?? getString("DevDetail_EveandAl_NewDevice"))} (${encodeSpecialChars(owner)})`; $('#pageTitle').html(pageTitleText); $('#devicePageInfoPlc').hide(); } diff --git a/front/deviceDetailsEdit.php b/front/deviceDetailsEdit.php index 542f2a59..99f22bf6 100755 --- a/front/deviceDetailsEdit.php +++ b/front/deviceDetailsEdit.php @@ -236,6 +236,7 @@ function getDeviceData() { // console.log(setting.setKey); // console.log(fieldData); + // Additional form elements like the random MAC address button for devMac let inlineControl = ""; // handle random mac @@ -329,6 +330,11 @@ function getDeviceData() { fieldOptionsOverride = fieldDataNew; } + // XSS prevention - encode special characters for string fields, but not for arrays (like children dynamic) + // Don't move above the handle devChildrenDynamic block because it relies on the original fieldData to generate options + fieldData = encodeSpecialChars(fieldData); + console.log(fieldData); + // Generate the input field HTML const inputFormHtml = `