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
Added sanitization for user display_name field, vulnerability reported by @CyberWarrior9
givanzfefac290a8c8
diff --git a/app/controller/content/comment-trait.php b/app/controller/content/comment-trait.phpindex 3fffa5e..3c4f7ee 100644--- a/app/controller/content/comment-trait.php+++ b/app/controller/content/comment-trait.php@@ -55,7 +55,7 @@ trait CommentTrait {//sanitize html and inline js code$post['content'] = sanitizeHTML($post['content']);- $post['author'] = sanitizeHTML(str_replace(str_split('(){}:'), '', $post['author']));+ $post['author'] = sanitizeHTML(stripChars($post['author']));$comment = array_merge($post, $user, ['created_at' => date('Y-m-d H:i:s'),diff --git a/system/functions.php b/system/functions.phpindex 9ef7b45..308f88d 100755--- a/system/functions.php+++ b/system/functions.php@@ -1429,6 +1429,10 @@ function stripTagsArray($array, $tags) {return $array;}+function stripChars($string, $chars = ['(', ')' , '{' , '}', ':', '<' , '>']) {+ return str_replace($chars, '', $string);+}+function sanitizeHTML($string) {if (! is_string($string)) {return $string;diff --git a/system/user/auth.php b/system/user/auth.phpindex 2820942..b48ee1b 100755--- a/system/user/auth.php+++ b/system/user/auth.php@@ -21,15 +21,27 @@*/namespace Vvveb\System\User;+use function Vvveb\stripChars;+use function Vvveb\sanitizeHTML;class Auth {static $options = ['cost' => 11];public static function sanitize(&$data) {+ foreach ($data as $name => &$val) {+ if (is_string($val) && !in_array($name, ['created_at', 'updated_at', 'bio'])) {+ $val = stripChars($val);+ }+ }+if (isset($data['username'])) {$data['username'] = preg_replace('/[^\w-]/', '', $data['username']);}+ if (isset($data['bio'])) {+ $data['bio'] = sanitizeHTML($data['bio']);+ }+if (isset($data['email'])) {$data['email'] = filter_var($data['email'], FILTER_VALIDATE_EMAIL);}