fix(editor): Restrict what binary-data types can be viewed in the UI (#14685)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2025-04-16 18:05:19 +02:00
committed by GitHub
parent 68a87619af
commit 11a36b758d
6 changed files with 93 additions and 29 deletions

View File

@@ -12,6 +12,7 @@ export { createHeartbeatMessage, heartbeatMessageSchema } from './push/heartbeat
export type { SendWorkerStatusMessage } from './push/worker';
export type { BannerName } from './schemas/bannerName.schema';
export { ViewableMimeTypes } from './schemas/binaryData.schema';
export { passwordSchema } from './schemas/password.schema';
export type {

View File

@@ -0,0 +1,32 @@
/**
* List of MIME types that are considered safe to be viewed directly in a browser.
*
* Explicitly excluded from this list:
* - 'text/html': Excluded due to high XSS risks, as HTML can execute arbitrary JavaScript
* - 'image/svg+xml': Excluded because SVG can contain embedded JavaScript that might execute in certain contexts
* - 'application/pdf': Excluded due to potential arbitrary code-execution vulnerabilities in PDF rendering engines
*/
export const ViewableMimeTypes = [
'application/json',
'audio/mpeg',
'audio/ogg',
'audio/wav',
'image/bmp',
'image/gif',
'image/jpeg',
'image/jpg',
'image/png',
'image/tiff',
'image/webp',
'text/css',
'text/csv',
'text/markdown',
'text/plain',
'video/mp4',
'video/ogg',
'video/webm',
];