summaryrefslogtreecommitdiff
path: root/lib/file-stroage.ts
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-11-10 11:25:19 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-11-10 11:25:19 +0900
commita5501ad1d1cb836d2b2f84e9b0f06049e22c901e (patch)
tree667ed8c5d6ec35b109190e9f976d66ae54def4ce /lib/file-stroage.ts
parentb0fe980376fcf1a19ff4b90851ca8b01f378fdc0 (diff)
parentf8a38907911d940cb2e8e6c9aa49488d05b2b578 (diff)
Merge remote-tracking branch 'origin/dujinkim' into master_homemaster
Diffstat (limited to 'lib/file-stroage.ts')
-rw-r--r--lib/file-stroage.ts12
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 타입을 확인할 수 없습니다" };
}