Skip to content

Commit

Permalink
Fixed issue [security] #17795: XSS in token browse (#2187)
Browse files Browse the repository at this point in the history
Dev: filter and encode
  • Loading branch information
Shnoulle committed Dec 22, 2021
1 parent 1c92f5d commit e8093fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion application/models/Token.php
Expand Up @@ -428,12 +428,13 @@ public function rules()
array('remindercount', 'numerical', 'integerOnly' => true, 'allowEmpty' => true),
array('email', 'filter', 'filter' => 'trim'),
array('email', 'LSYii_EmailIDNAValidator', 'allowEmpty' => true, 'allowMultiple' => true, 'except' => 'allowinvalidemail'),
array('emailstatus', 'default', 'value' => 'OK'),
array('emailstatus', 'filter', 'filter' => array(self::class, 'sanitizeAttribute')),
array('usesleft', 'numerical', 'integerOnly' => true, 'allowEmpty' => true, 'min' => -2147483647, 'max' => 2147483647),
array('mpid', 'numerical', 'integerOnly' => true, 'allowEmpty' => true),
array('blacklisted', 'in', 'range' => array('Y', 'N'), 'allowEmpty' => true),
array('validfrom', 'date','format' => ['yyyy-M-d H:m:s.???','yyyy-M-d H:m:s','yyyy-M-d H:m','yyyy-M-d'],'allowEmpty' => true),
array('validuntil','date','format' => ['yyyy-M-d H:m:s.???','yyyy-M-d H:m:s','yyyy-M-d H:m','yyyy-M-d'],'allowEmpty' => true),
array('emailstatus', 'default', 'value' => 'OK'),
);
foreach (decodeTokenAttributes($this->survey->attributedescriptions) as $key => $info) {
$aRules[] = array(
Expand Down
8 changes: 4 additions & 4 deletions application/models/TokenDynamic.php
Expand Up @@ -589,9 +589,9 @@ private function getYesNoDateFormated($field)
public function getEmailFormated()
{
if ($this->emailstatus == "bounced") {
return '<span class="text-warning"><strong> ' . $this->email . '</strong></span>';
return '<span class="text-warning"><strong> ' . CHtml::encode($this->email) . '</strong></span>';
} else {
return $this->email;
return CHtml::encode($this->email);
}
}

Expand All @@ -601,9 +601,9 @@ public function getEmailFormated()
public function getEmailstatusFormated()
{
if ($this->emailstatus == "bounced") {
return '<span class="text-warning"><strong> ' . $this->emailstatus . '</strong></span>';
return '<span class="text-warning"><strong> ' . CHtml::encode($this->emailstatus) . '</strong></span>';
} else {
return $this->emailstatus;
return CHtml::encode($this->emailstatus);
}
}

Expand Down

0 comments on commit e8093fb

Please sign in to comment.