Skip to content

Commit

Permalink
[security] Fix cross-site scripting issue with the theme parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentj committed Jun 17, 2024
1 parent ee7fceb commit 98c58bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions lizmap/modules/view/controllers/default.classic.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Displays a list of project for a given repository.
*
* @author 3liz
* @copyright 2012-2023 3liz
* @copyright 2012-2024 3liz
*
* @see http://3liz.com
*
Expand All @@ -20,8 +20,9 @@ class defaultCtrl extends jController
*/
public function index()
{
if ($this->param('theme')) {
jApp::config()->theme = $this->param('theme');
$theme = $this->param('theme');
if ($theme && preg_match('/^[a-zA-Z0-9\-_]+$/', $theme)) {
jApp::config()->theme = $theme;
}

/** @var jResponseHtml $rep */
Expand Down
6 changes: 3 additions & 3 deletions lizmap/modules/view/controllers/lizMap.classic.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ class lizMapCtrl extends jController
*/
public function index()
{
if ($this->param('theme')) {
jApp::config()->theme = $this->param('theme');
$theme = $this->param('theme');
if ($theme && preg_match('/^[a-zA-Z0-9\-_]+$/', $theme)) {
jApp::config()->theme = $theme;
}
$ok = true;

// Get the project
$project = htmlspecialchars(strip_tags($this->param('project')));
Expand Down

0 comments on commit 98c58bb

Please sign in to comment.