Skip to content

Commit 36d0c88

Browse files
authored
Fix/url regex (#1842)
* fix: Tweak URL's regex to avoid XSS. Thanks to @rgavilan for the feedback! Closes #1840. Signed-off-by: Rubén D <[email protected]> * chore: Update dependencies. Signed-off-by: Rubén D <[email protected]> * chore: Use `ENT_QUOTES` flag for all `htmlspecialchars` calls. Signed-off-by: Rubén D <[email protected]>
1 parent b1e7edd commit 36d0c88

File tree

11 files changed

+244
-85
lines changed

11 files changed

+244
-85
lines changed

app/modules/web/themes/material-blue/views/account/account-editpass.inc

+23
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
11
<?php
2+
/*
3+
* sysPass
4+
*
5+
* @author nuxsmin
6+
* @link https://syspass.org
7+
* @copyright 2012-2022, Rubén Domínguez nuxsmin@$syspass.org
8+
*
9+
* This file is part of sysPass.
10+
*
11+
* sysPass is free software: you can redistribute it and/or modify
12+
* it under the terms of the GNU General Public License as published by
13+
* the Free Software Foundation, either version 3 of the License, or
14+
* (at your option) any later version.
15+
*
16+
* sysPass is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU General Public License
22+
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
23+
*/
24+
225
/**
326
* @var callable $_getvar
427
* @var ThemeIcons $icons

app/modules/web/themes/material-blue/views/account/account-history.inc

+23
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
11
<?php
2+
/*
3+
* sysPass
4+
*
5+
* @author nuxsmin
6+
* @link https://syspass.org
7+
* @copyright 2012-2022, Rubén Domínguez nuxsmin@$syspass.org
8+
*
9+
* This file is part of sysPass.
10+
*
11+
* sysPass is free software: you can redistribute it and/or modify
12+
* it under the terms of the GNU General Public License as published by
13+
* the Free Software Foundation, either version 3 of the License, or
14+
* (at your option) any later version.
15+
*
16+
* sysPass is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU General Public License
22+
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
23+
*/
24+
225
/**
326
* @var callable $_getvar
427
* @var ThemeIcons $icons

app/modules/web/themes/material-blue/views/account/account-link.inc

+23
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
11
<?php
2+
/*
3+
* sysPass
4+
*
5+
* @author nuxsmin
6+
* @link https://syspass.org
7+
* @copyright 2012-2022, Rubén Domínguez nuxsmin@$syspass.org
8+
*
9+
* This file is part of sysPass.
10+
*
11+
* sysPass is free software: you can redistribute it and/or modify
12+
* it under the terms of the GNU General Public License as published by
13+
* the Free Software Foundation, either version 3 of the License, or
14+
* (at your option) any later version.
15+
*
16+
* sysPass is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU General Public License
22+
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
23+
*/
24+
225
/**
326
* @var callable $_getvar
427
* @var ThemeIcons $icons

app/modules/web/themes/material-blue/views/account/search-rows.inc

+11-3
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ $favoriteRouteOff = $_getvar('favoriteRouteOff');
134134
<?php echo htmlspecialchars($accountSearchItem->getShortUrl(), ENT_QUOTES); ?>
135135
</a>
136136
<?php else: ?>
137-
<div class="field-text"><?php echo htmlspecialchars($accountSearchItem->getShortUrl(), ENT_QUOTES); ?></div>
137+
<div class="field-text"><?php echo htmlspecialchars(
138+
$accountSearchItem->getShortUrl(),
139+
ENT_QUOTES
140+
); ?></div>
138141
<?php endif; ?>
139142
</div>
140143
<?php else: ?>
@@ -280,15 +283,20 @@ $favoriteRouteOff = $_getvar('favoriteRouteOff');
280283
<?php if ($wikiFilter
281284
&& $accountSearchItem->isWikiMatch($wikiFilter)): ?>
282285
<?php if (AccountSearchItem::$dokuWikiEnabled): ?>
283-
<a href="<?php echo $_getvar('wikiPageUrl'), urldecode($accountSearchData->getName()); ?>"
286+
<a href="<?php echo $_getvar('wikiPageUrl'), urlencode(
287+
$accountSearchData->getName()
288+
); ?>"
284289
target="_blank">
285290
<i class="material-icons"
286291
title="<?php echo __('Link to Wiki'); ?>">library_books</i>
287292
</a>
288293
<i class="btn-action material-icons fg-green100"
289294
title="<?php echo __('View at Wiki'); ?>"
290295
data-action-route="<?php echo ActionsInterface::WIKI_VIEW; ?>"
291-
data-pagename="<?php echo htmlspecialchars($accountSearchData->getName(), ENT_QUOTES); ?>"
296+
data-pagename="<?php echo htmlspecialchars(
297+
$accountSearchData->getName(),
298+
ENT_QUOTES
299+
); ?>"
292300
data-onclick="wiki/show">library_books</i>
293301
<?php else: ?>
294302
<a href="<?php echo $_getvar('wikiPageUrl'), urlencode($accountSearchData->getName()); ?>"

app/modules/web/themes/material-blue/views/config/general-site.inc

+26-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
11
<?php
2+
/*
3+
* sysPass
4+
*
5+
* @author nuxsmin
6+
* @link https://syspass.org
7+
* @copyright 2012-2022, Rubén Domínguez nuxsmin@$syspass.org
8+
*
9+
* This file is part of sysPass.
10+
*
11+
* sysPass is free software: you can redistribute it and/or modify
12+
* it under the terms of the GNU General Public License as published by
13+
* the Free Software Foundation, either version 3 of the License, or
14+
* (at your option) any later version.
15+
*
16+
* sysPass is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU General Public License
22+
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
23+
*/
24+
225
/**
326
* @var ThemeIcons $icons
427
* @var ConfigData $configData
@@ -109,7 +132,9 @@ use SP\Mvc\View\Template;
109132
class="icon material-icons <?php echo $icons->getIconHelp()->getClass(); ?>"><?php echo $icons->getIconHelp()->getIcon(); ?></div>
110133
<div class="mdl-tooltip mdl-tooltip--large" for="help-app_url">
111134
<p>
112-
<?php echo __('Sets the application URL when accessing through a reverse proxy or load balancer.'); ?>
135+
<?php echo __(
136+
'Sets the application URL when accessing through a reverse proxy or load balancer.'
137+
); ?>
113138
</p>
114139
</div>
115140
</td>

app/modules/web/themes/material-blue/views/config/wiki-dokuwiki.inc

+27-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
11
<?php
2+
/*
3+
* sysPass
4+
*
5+
* @author nuxsmin
6+
* @link https://syspass.org
7+
* @copyright 2012-2022, Rubén Domínguez nuxsmin@$syspass.org
8+
*
9+
* This file is part of sysPass.
10+
*
11+
* sysPass is free software: you can redistribute it and/or modify
12+
* it under the terms of the GNU General Public License as published by
13+
* the Free Software Foundation, either version 3 of the License, or
14+
* (at your option) any later version.
15+
*
16+
* sysPass is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU General Public License
22+
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
23+
*/
24+
225
/**
326
* @var ThemeIcons $icons
427
* @var ConfigData $configData
@@ -97,7 +120,8 @@ use SP\Mvc\View\Template;
97120
<td class="descField">
98121
<?php echo __('Base URL'); ?>
99122
<div id="help-dokuwiki_urlbase"
100-
class="icon material-icons <?php echo $icons->getIconHelp()->getClass(); ?>"><?php echo $icons->getIconHelp()->getIcon(); ?></div>
123+
class="icon material-icons <?php echo $icons->getIconHelp()->getClass(
124+
); ?>"><?php echo $icons->getIconHelp()->getIcon(); ?></div>
101125
<div class="mdl-tooltip mdl-tooltip--large"
102126
for="help-dokuwiki_urlbase">
103127
<p>
@@ -128,7 +152,8 @@ use SP\Mvc\View\Template;
128152
<td class="descField">
129153
<?php echo __('User'); ?>
130154
<div id="help-dokuwiki_user"
131-
class="icon material-icons <?php echo $icons->getIconHelp()->getClass(); ?>"><?php echo $icons->getIconHelp()->getIcon(); ?></div>
155+
class="icon material-icons <?php echo $icons->getIconHelp()->getClass(
156+
); ?>"><?php echo $icons->getIconHelp()->getIcon(); ?></div>
132157
<div class="mdl-tooltip mdl-tooltip--large"
133158
for="help-dokuwiki_user">
134159
<p>

app/modules/web/themes/material-blue/views/config/wiki.inc

+27-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
11
<?php
2+
/*
3+
* sysPass
4+
*
5+
* @author nuxsmin
6+
* @link https://syspass.org
7+
* @copyright 2012-2022, Rubén Domínguez nuxsmin@$syspass.org
8+
*
9+
* This file is part of sysPass.
10+
*
11+
* sysPass is free software: you can redistribute it and/or modify
12+
* it under the terms of the GNU General Public License as published by
13+
* the Free Software Foundation, either version 3 of the License, or
14+
* (at your option) any later version.
15+
*
16+
* sysPass is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU General Public License
22+
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
23+
*/
24+
225
/**
326
* @var ThemeIcons $icons
427
* @var ConfigData $configData
@@ -84,7 +107,8 @@ use SP\Mvc\View\Template;
84107
<td class="descField">
85108
<?php echo __('Wiki page URL'); ?>
86109
<div id="help-wiki_pageurl"
87-
class="icon material-icons <?php echo $icons->getIconHelp()->getClass(); ?>"><?php echo $icons->getIconHelp()->getIcon(); ?></div>
110+
class="icon material-icons <?php echo $icons->getIconHelp()->getClass(
111+
); ?>"><?php echo $icons->getIconHelp()->getIcon(); ?></div>
88112
<div class="mdl-tooltip mdl-tooltip--large"
89113
for="help-wiki_pageurl">
90114
<p>
@@ -119,7 +143,8 @@ use SP\Mvc\View\Template;
119143
<td class="descField">
120144
<?php echo __('Account name prefix'); ?>
121145
<div id="help-wikifilter"
122-
class="icon material-icons <?php echo $icons->getIconHelp()->getClass(); ?>"><?php echo $icons->getIconHelp()->getIcon(); ?></div>
146+
class="icon material-icons <?php echo $icons->getIconHelp()->getClass(
147+
); ?>"><?php echo $icons->getIconHelp()->getIcon(); ?></div>
123148
<div class="mdl-tooltip mdl-tooltip--large"
124149
for="help-wikifilter">
125150
<p>

composer.json

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
},
6666
"config": {
6767
"classmap-authoritative": false,
68-
"platform-check": false,
6968
"platform": {
7069
"php": "7.4"
7170
}

0 commit comments

Comments
 (0)