#1860 embed filter에 사용되는 도메인 목록에 대한 escape 처리

- escape 되지 않은 dot(.)으로 인해 유사 도메인에 대한 공격에 노출될 수 있는 문제
This commit is contained in:
bnu 2016-02-18 16:21:46 +09:00
parent 6cb5733cad
commit 054e92e0b4

View file

@ -142,28 +142,16 @@ class Purifier
private function _getWhiteDomainRegx()
{
require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php');
$oEmbedFilter = EmbedFilter::getInstance();
$whiteIframeUrlList = $oEmbedFilter->getWhiteIframeUrlList();
$whiteDomainRegex = '%^(';
$whiteDomainCount = count($whiteIframeUrlList);
$i=1;
if(is_array($whiteIframeUrlList))
$whiteDomain = array();
foreach($whiteIframeUrlList as $value)
{
foreach($whiteIframeUrlList as $value)
{
$whiteDomainRegex .= $value;
if($i < $whiteDomainCount)
{
$whiteDomainRegex .= '|';
}
$i++;
}
$whiteDomain[] = preg_quote($value, '%');
}
$whiteDomainRegex .= ')%';
$whiteDomainRegex = '%^(' . implode('|', $whiteDomain) . ')%';
return $whiteDomainRegex;
}