security: SVG 및 SVGZ 파일 업로드 차단
게시판, 1:1문의, 폼메일 및 쇼핑몰 설정의 클라이언트와 서버 검증에서 SVG 계열 파일 업로드를 거부한다.
This commit is contained in:
1 parent
4e8474f231
commit
0242e8f1a3
7 files changed
+156
-5
No files matched your search
@@ -4011,6 +4011,26 @@ function get_safe_filename($name)
|
||||
return $name;
|
||||
}
|
||||
|
||||
// 업로드 파일명이 SVG 또는 SVGZ 확장자인지 확인
|
||||
function is_disallowed_svg_filename($filename)
|
||||
{
|
||||
if (!is_string($filename) || $filename === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$filename = str_replace(array("\0", '\\'), array('', '/'), $filename);
|
||||
$filename = basename($filename);
|
||||
$filename = rtrim($filename, " .\t\n\r\0\x0B");
|
||||
|
||||
if ($filename === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
|
||||
|
||||
return in_array($extension, array('svg', 'svgz'), true);
|
||||
}
|
||||
|
||||
// 파일명 치환
|
||||
function replace_filename($name)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user