diff options
Diffstat (limited to 'lib/file-stroage.ts')
| -rw-r--r-- | lib/file-stroage.ts | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/file-stroage.ts b/lib/file-stroage.ts index 34b9983a..cb6fdfbd 100644 --- a/lib/file-stroage.ts +++ b/lib/file-stroage.ts @@ -28,7 +28,9 @@ const SECURITY_CONFIG = { 'exe', 'bat', 'cmd', 'scr', 'vbs', 'js', 'jar', 'com', 'pif', 'msi', 'reg', 'ps1', 'sh', 'php', 'asp', 'jsp', 'py', 'pl', // XSS 방지를 위한 추가 확장자 - 'html', 'htm', 'xhtml', 'xml', 'xsl', 'xslt','svg' + 'html', 'htm', 'xhtml', 'xml', 'xsl', 'xslt','svg', + // 돌체 블랙리스트 추가 + 'dll', 'vbs', 'js', 'aspx', 'cmd' ]), // 허용된 MIME 타입 @@ -45,7 +47,7 @@ const SECURITY_CONFIG = { 'application/zip', 'application/x-rar-compressed', 'application/x-7z-compressed' ]), - // 최대 파일 크기 (100MB) + // 최대 파일 크기 (1GB) MAX_FILE_SIZE: 1024 * 1024 * 1024, // 파일명 최대 길이 @@ -129,6 +131,12 @@ class FileSecurityValidator { // MIME 타입 검증 static validateMimeType(mimeType: string, fileName: string): { valid: boolean; error?: string } { if (!mimeType) { + // xlsx 파일의 경우 MIME 타입이 누락될 수 있으므로 경고만 표시 + const extension = path.extname(fileName).toLowerCase().substring(1); + if (['xlsx', 'xls', 'docx', 'doc', 'pptx', 'ppt', 'pdf', 'dwg', 'dxf', 'zip', 'rar', '7z'].includes(extension)) { + console.warn(`⚠️ MIME 타입 누락 (Office 파일 및 주요 확장자): ${fileName}, 확장자 기반으로 허용`); + return { valid: true }; // 확장자 기반으로 허용 + } return { valid: false, error: "MIME 타입을 확인할 수 없습니다" }; } |
