mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-04 23:17:02 +03:00
Security fix
This commit is contained in:
parent
85ddad1f1b
commit
c9e394c585
1 changed files with 11 additions and 1 deletions
|
|
@ -484,7 +484,7 @@ class HtmlUtils
|
||||||
{
|
{
|
||||||
$oElement->setAttribute('src', 'javascript:false');
|
$oElement->setAttribute('src', 'javascript:false');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\in_array($sTagNameLower, array('a', 'form', 'area')))
|
if (\in_array($sTagNameLower, array('a', 'form', 'area')))
|
||||||
{
|
{
|
||||||
$oElement->setAttribute('target', '_blank');
|
$oElement->setAttribute('target', '_blank');
|
||||||
|
|
@ -507,6 +507,16 @@ class HtmlUtils
|
||||||
@$oElement->removeAttribute('data-bind');
|
@$oElement->removeAttribute('data-bind');
|
||||||
@$oElement->removeAttribute('xmlns');
|
@$oElement->removeAttribute('xmlns');
|
||||||
|
|
||||||
|
if ($oElement->hasAttribute('href'))
|
||||||
|
{
|
||||||
|
$sHref = \trim($oElement->getAttribute('href'));
|
||||||
|
if (!\preg_match('/^(http[s]?|ftp|skype|mailto):/i', $sHref))
|
||||||
|
{
|
||||||
|
$oElement->setAttribute('data-x-broken-href', $sHref);
|
||||||
|
$oElement->setAttribute('href', 'javascript:false');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($oElement->hasAttribute('src'))
|
if ($oElement->hasAttribute('src'))
|
||||||
{
|
{
|
||||||
$sSrc = \trim($oElement->getAttribute('src'));
|
$sSrc = \trim($oElement->getAttribute('src'));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue