mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
fix #1813 레이아웃 미리보기 동작에 CSRF/XSS 방어 및 embed URL에 'act' parameter 사용 제한
- `layoutView::dispLayoutPreview()`에 XSS/CSRF 방어 - src, href, style 등 HTML attribute에 'act'를 포함하는 URL을 사용할 수 없도록 제한
This commit is contained in:
parent
ca0fb36fb8
commit
c1eab055bc
4 changed files with 42 additions and 54 deletions
|
|
@ -1212,6 +1212,24 @@ function removeSrcHack($match)
|
|||
}
|
||||
}
|
||||
|
||||
$filter_arrts = array('style', 'src', 'href');
|
||||
|
||||
if($tag === 'object') array_push($filter_arrts, 'data');
|
||||
if($tag === 'param') array_push($filter_arrts, 'value');
|
||||
|
||||
foreach($filter_arrts as $attr)
|
||||
{
|
||||
if(!isset($attrs[$attr])) continue;
|
||||
|
||||
$attr_value = rawurldecode($attrs[$attr]);
|
||||
$attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT);
|
||||
$attr_value = preg_replace('/\s+|[\t\n\r]+/', '', $attr_value);
|
||||
if(preg_match('@(\?|&|;)(act=)@i', $attr_value))
|
||||
{
|
||||
unset($attrs[$attr]);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style']))
|
||||
{
|
||||
unset($attrs['style']);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue