Skip to content

Commit

Permalink
xss fix on tagging module
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Feb 10, 2022
1 parent ccacc52 commit 14a1bb9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/MicroweberPackages/Helper/HTMLClean.php
Expand Up @@ -4,6 +4,18 @@

class HTMLClean
{
public function cleanArray($array) {
if (is_array($array)) {

$cleanedArray = [];
foreach ($array as $key=>$value) {
$cleanedArray[$key] = $this->clean($value);
}

return $cleanedArray;
}
}

public function clean($html) {

$antiXss = new \voku\helper\AntiXSS();
Expand Down
4 changes: 3 additions & 1 deletion userfiles/modules/tags/TaggingTagsManager.php
Expand Up @@ -66,6 +66,9 @@ function tagging_tag_edit($params) {
$newData['id'] = $params['id'];
}

$cleanInput = new \MicroweberPackages\Helper\HTMLClean();
$newData = $cleanInput->cleanArray($newData);

if (isset($params['tagging_tag_id']) && !empty($params['tagging_tag_id'])) {
$tagging_tag_id = $params['tagging_tag_id'];
$tag = db_get('tagging_tags', [
Expand Down Expand Up @@ -105,7 +108,6 @@ function tagging_tag_edit($params) {
}
}


$tagSaved = db_save('tagging_tags',$newData);
if ($tagSaved) {

Expand Down

0 comments on commit 14a1bb9

Please sign in to comment.