diff --git a/CHANGELOG b/CHANGELOG
index 0d144398a..80ce64940 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,7 @@
- fix rest api endpoint PUT /folder/{id}/comment
- show document preview when editing attributes of a document
- fix utilities which require translations
+- fix potential XSS attack when deleting a folder/document
--------------------------------------------------------------------------------
Changes in version 5.1.44
diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php
index dd0e50ece..376e7b557 100644
--- a/views/bootstrap/class.Bootstrap.php
+++ b/views/bootstrap/class.Bootstrap.php
@@ -2618,7 +2618,7 @@ $(function() {
function printDeleteDocumentButton($document, $msg, $return=false){ /* {{{ */
$docid = $document->getID();
$content = '';
- $content .= ' $document->getName())), ENT_QUOTES).'" title="'.getMLText("delete").'">';
+ $content .= ' htmlspecialchars($document->getName()))), ENT_QUOTES).'" title="'.getMLText("delete").'">';
if($return)
return $content;
else
@@ -2692,7 +2692,7 @@ $(function() {
function printDeleteFolderButton($folder, $msg, $return=false){ /* {{{ */
$folderid = $folder->getID();
$content = '';
- $content .= ' $folder->getName())), ENT_QUOTES).'" title="'.getMLText("delete").'">';
+ $content .= ' htmlspecialchars($folder->getName()))), ENT_QUOTES).'" title="'.getMLText("delete").'">';
if($return)
return $content;
else
diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php
index c841a5816..c4d2a84f1 100644
--- a/views/bootstrap4/class.Bootstrap4.php
+++ b/views/bootstrap4/class.Bootstrap4.php
@@ -2644,7 +2644,7 @@ $(function() {
function printDeleteDocumentButton($document, $msg, $return=false){ /* {{{ */
$docid = $document->getID();
$content = '';
- $content .= ' $document->getName())), ENT_QUOTES).'" title="'.getMLText("delete").'">';
+ $content .= ' htmlspecialchars($document->getName()))), ENT_QUOTES).'" title="'.getMLText("delete").'">';
if($return)
return $content;
else
@@ -2724,7 +2724,7 @@ $(function() {
function printDeleteFolderButton($folder, $msg, $return=false){ /* {{{ */
$folderid = $folder->getID();
$content = '';
- $content .= ' $folder->getName())), ENT_QUOTES).'" title="'.getMLText("delete").'">';
+ $content .= ' htmlspecialchars($folder->getName()))), ENT_QUOTES).'" title="'.getMLText("delete").'">';
if($return)
return $content;
else