소스 검색

Create mime type allowlist

arvid-e 9 달 전
부모
커밋
930d31e1fa
1개의 변경된 파일13개의 추가작업 그리고 0개의 파일을 삭제
  1. 13 0
      apps/app/src/server/service/file-uploader/utils/security.ts

+ 13 - 0
apps/app/src/server/service/file-uploader/utils/security.ts

@@ -0,0 +1,13 @@
+/**
+ * Defines MIME types that are explicitly safe for INLINE display when served
+ * from user uploads. All other types will be forced to download, regardless of
+ * their file extension or sniffed content.
+ */
+export const INLINE_ALLOWLIST_MIME_TYPES = new Set<string>([
+  'image/png',
+  'image/jpeg',
+  'image/gif',
+  'image/webp',
+  'image/bmp',
+  'image/x-icon',
+]);