Skip to content

Commit

Permalink
Fixed issue #18669: XSS simple admin via Google key (#3004)
Browse files Browse the repository at this point in the history
* Fixed issue #18669: XSS simple admin via Google key

* Fixed issue #18669: XSS simple admin via Google key

---------

Co-authored-by: lapiudevgit <devgit@lapiu.biz>
  • Loading branch information
gabrieljenik and lapiudevgit committed Jun 6, 2023
1 parent d9b74f2 commit 6f105d0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions application/models/Survey.php
Expand Up @@ -550,6 +550,11 @@ public function rules()
array('startdate', 'date','format' => ['yyyy-M-d H:m:s.???','yyyy-M-d H:m:s','yyyy-M-d H:m'],'allowEmpty' => true),
array('datecreated', 'date','format' => ['yyyy-M-d H:m:s.???','yyyy-M-d H:m:s','yyyy-M-d H:m'],'allowEmpty' => true),
array('expires', 'checkExpireAfterStart'),
// The Google Analytics Tracking ID is inserted in a JS script. If the following rule is changed, make sure
// that it doesn't render it vulnerable to XSS attacks.
array('googleanalyticsapikey', 'match', 'pattern' => '/^[a-zA-Z\-\d]*$/',
'message' => gT('Google Analytics Tracking ID may only contain alphanumeric characters and hyphens.'),
),
);
}

Expand Down Expand Up @@ -841,11 +846,13 @@ public function setGoogleanalyticsapikeysetting($value)
*/
public function getGoogleanalyticsapikey()
{
$key = null;
if ($this->googleanalyticsapikey === "9999useGlobal9999") {
return trim((string) Yii::app()->getConfig('googleanalyticsapikey'));
$key = trim((string) Yii::app()->getConfig('googleanalyticsapikey'));
} else {
return trim((string) $this->googleanalyticsapikey);
$key = trim((string) $this->googleanalyticsapikey);
}
return sanitize_alphanumeric($key);
}

/**
Expand Down

0 comments on commit 6f105d0

Please sign in to comment.