Преглед на файлове

Create mime type allowlist

arvid-e преди 10 месеца
родител
ревизия
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',
+]);