Powerful and easy to use cms to build websites, blogs or ecommerce stores.
HTML backendblogblog-engineblog-platformbloggingcmscontent-managementcontent-management-systemecommerceecommerce-platformno-codepage-builderphpphp-cmsphp7php8self-hostedshopping-cartweb-applicationwebsite-builder
Fix for Stored XSS via Comment Author Field #GHSA-gpmg-pcxr-9wvf reported by @nchloride
givanz4cd2962fa0a4
diff --git a/admin/controller/content/comments.php b/admin/controller/content/comments.phpindex a5f7f85..64d49fb 100644--- a/admin/controller/content/comments.php+++ b/admin/controller/content/comments.php@@ -102,6 +102,12 @@ class Comments extends Listing {$url = ['module' => "$module/$listController", 'action' => 'save', 'status' => $status, $type . '_id' => $comment[$type . '_id']];$postUrl = ['module' => "$module/$controller", $type . '_id' => $comment[$type . '_id']];++ $comment['author-url'] = '';+ if ($comment['user_id']) {+ $comment['author-url'] = \Vvveb\url(['module' => 'user/user', 'user_id' => $comment['user_id']]);+ }+$comment['edit-url'] = \Vvveb\url($postUrl);$comment['delete-url'] = \Vvveb\url(['module' => "$module/$listController", 'action' => 'delete'] + $url);$comment['approve-url'] = \Vvveb\url(['newstatus' => 1] + $url);diff --git a/app/controller/content/comment-trait.php b/app/controller/content/comment-trait.phpindex ce74ff4..3fffa5e 100644--- a/app/controller/content/comment-trait.php+++ b/app/controller/content/comment-trait.php@@ -53,7 +53,9 @@ trait CommentTrait {$user['author'] = $user['display_name'];}+ //sanitize html and inline js code$post['content'] = sanitizeHTML($post['content']);+ $post['author'] = sanitizeHTML(str_replace(str_split('(){}:'), '', $post['author']));$comment = array_merge($post, $user, ['created_at' => date('Y-m-d H:i:s'),diff --git a/public/js/app.js b/public/js/app.jsindex a121679..ae103ae 100755--- a/public/js/app.js+++ b/public/js/app.js@@ -574,7 +574,7 @@ VvvebTheme.Gui = {if (commentId > 0) {document.querySelector(".replyto").style.display = "";- document.querySelector(".replyto [data-comment-author]").innerHTML = commentAuthor;+ document.querySelector(".replyto [data-comment-author]").textContent = commentAuthor;} else {document.querySelector(".replyto").style.display = "none";}