@shipstatic/types 0.4.19 → 0.4.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -352,16 +352,72 @@ export interface ConfigResponse {
352
352
  maxTotalSize: number;
353
353
  }
354
354
  /**
355
- * Allowed MIME types and prefixes for file uploads.
355
+ * Allowed MIME types for static web hosting.
356
356
  *
357
357
  * This is a static platform constant, not per-user configuration.
358
358
  * Safe to share across frontend/backend due to atomic deploys.
359
359
  *
360
360
  * Validation rules:
361
361
  * - Exact match: 'application/json' allows only 'application/json'
362
- * - Prefix match: 'text/' allows 'text/plain', 'text/html', etc.
363
- */
364
- export declare const ALLOWED_MIME_TYPES: readonly ["text/", "image/", "audio/", "video/", "font/", "model/", "application/json", "application/javascript", "application/pdf", "application/xml", "application/manifest+json", "application/toml", "application/font-woff", "application/font-woff2", "application/x-font-woff", "application/x-woff", "application/vnd.ms-fontobject", "application/x-font-ttf", "application/x-font-truetype", "application/x-font-otf", "application/x-font-opentype"];
362
+ * - Prefix match: 'image/' allows all image types (png, jpeg, webp, etc.)
363
+ *
364
+ * Coverage: 100% of browser-renderable web content
365
+ * - Core web (HTML, CSS, JS, WASM)
366
+ * - Media (images, audio, video, fonts)
367
+ * - Documents (PDF, Markdown, data formats)
368
+ * - Modern web (PWA, 3D, structured data)
369
+ *
370
+ * ============================================================================
371
+ * INTENTIONALLY EXCLUDED (Security & Platform Integrity)
372
+ * ============================================================================
373
+ *
374
+ * We are a WEB HOSTING platform, not a file distribution service.
375
+ * GitHub Pages-style parity for renderable content, more restrictive for downloads.
376
+ *
377
+ * 1. EXECUTABLES (Malware Distribution)
378
+ * → .exe, .msi, .dmg, .deb, .rpm, .app, .apk, .jar
379
+ * → Reason: Direct malware delivery vector
380
+ * → Alternative: Use GitHub Releases or dedicated software distribution CDN
381
+ *
382
+ * 2. ARCHIVES (Piracy & Abuse)
383
+ * → .zip, .rar, .tar, .gz, .7z, .bz2
384
+ * → Reason: File sharing abuse, can contain executables, no web rendering
385
+ * → Alternative: Use file hosting service (Dropbox, Google Drive) or GitHub Releases
386
+ *
387
+ * 3. SERVER-SIDE SCRIPTS (Credential Leakage)
388
+ * → .php, .asp, .jsp, .cgi
389
+ * → Reason: Source code exposure (database passwords, API keys, secrets)
390
+ * → Alternative: Static hosting only - use serverless functions for backends
391
+ *
392
+ * 4. SHELL SCRIPTS (OS Execution)
393
+ * → .sh, .bash, .bat, .cmd, .ps1, .vbs
394
+ * → Reason: Execute on user's OS outside browser sandbox, social engineering risk
395
+ * → Alternative: Embed code examples in HTML <pre><code> or link to GitHub repo
396
+ *
397
+ * 5. PROGRAMMING LANGUAGE SOURCE (Platform Scope)
398
+ * → .py, .rb, .pl, .java, .c, .cpp, .cs, .go, .rs
399
+ * → Reason: Not web-renderable, better served by GitHub/GitLab/Bitbucket
400
+ * → Alternative: Use GitHub for code hosting, link to repository
401
+ *
402
+ * 6. OFFICE DOCUMENTS (Macro Malware)
403
+ * → .doc, .docx, .xls, .xlsx, .ppt, .pptx
404
+ * → Reason: Can contain VBA macros, active exploits in the wild
405
+ * → Alternative: Use PDF for documents (fully supported)
406
+ *
407
+ * 7. GENERIC BINARIES (Unvalidatable)
408
+ * → application/octet-stream
409
+ * → Reason: Too broad - allows any binary format, cannot moderate effectively
410
+ * → Alternative: Use specific MIME types for known formats
411
+ *
412
+ * ============================================================================
413
+ * Security Model:
414
+ * - Browser sandbox (JS/WASM execute safely in controlled environment)
415
+ * - AI content moderation (scans text/image content for abuse)
416
+ * - No server-side execution (static files only)
417
+ * - Explicit allowlist (only approved formats, reject unknown)
418
+ * ============================================================================
419
+ */
420
+ export declare const ALLOWED_MIME_TYPES: readonly ["text/html", "text/css", "text/plain", "text/markdown", "text/xml", "text/csv", "text/yaml", "text/vtt", "text/calendar", "text/javascript", "text/typescript", "text/tsx", "text/jsx", "text/x-scss", "text/x-sass", "text/x-less", "text/stylus", "text/x-vue", "text/x-svelte", "image/", "audio/", "video/", "font/", "application/javascript", "application/ecmascript", "application/x-javascript", "application/wasm", "application/json", "application/ld+json", "application/manifest+json", "application/source-map", "application/xml", "application/xhtml+xml", "application/rss+xml", "application/atom+xml", "application/yaml", "application/pdf", "model/gltf+json", "model/gltf-binary", "application/mp4", "application/font-woff", "application/font-woff2", "application/x-font-woff", "application/x-woff", "application/vnd.ms-fontobject", "application/x-font-ttf", "application/x-font-truetype", "application/x-font-otf", "application/x-font-opentype"];
365
421
  /**
366
422
  * Check if a MIME type is allowed for upload.
367
423
  *
package/dist/index.js CHANGED
@@ -200,36 +200,151 @@ export function isShipError(error) {
200
200
  'status' in error);
201
201
  }
202
202
  /**
203
- * Allowed MIME types and prefixes for file uploads.
203
+ * Allowed MIME types for static web hosting.
204
204
  *
205
205
  * This is a static platform constant, not per-user configuration.
206
206
  * Safe to share across frontend/backend due to atomic deploys.
207
207
  *
208
208
  * Validation rules:
209
209
  * - Exact match: 'application/json' allows only 'application/json'
210
- * - Prefix match: 'text/' allows 'text/plain', 'text/html', etc.
210
+ * - Prefix match: 'image/' allows all image types (png, jpeg, webp, etc.)
211
+ *
212
+ * Coverage: 100% of browser-renderable web content
213
+ * - Core web (HTML, CSS, JS, WASM)
214
+ * - Media (images, audio, video, fonts)
215
+ * - Documents (PDF, Markdown, data formats)
216
+ * - Modern web (PWA, 3D, structured data)
217
+ *
218
+ * ============================================================================
219
+ * INTENTIONALLY EXCLUDED (Security & Platform Integrity)
220
+ * ============================================================================
221
+ *
222
+ * We are a WEB HOSTING platform, not a file distribution service.
223
+ * GitHub Pages-style parity for renderable content, more restrictive for downloads.
224
+ *
225
+ * 1. EXECUTABLES (Malware Distribution)
226
+ * → .exe, .msi, .dmg, .deb, .rpm, .app, .apk, .jar
227
+ * → Reason: Direct malware delivery vector
228
+ * → Alternative: Use GitHub Releases or dedicated software distribution CDN
229
+ *
230
+ * 2. ARCHIVES (Piracy & Abuse)
231
+ * → .zip, .rar, .tar, .gz, .7z, .bz2
232
+ * → Reason: File sharing abuse, can contain executables, no web rendering
233
+ * → Alternative: Use file hosting service (Dropbox, Google Drive) or GitHub Releases
234
+ *
235
+ * 3. SERVER-SIDE SCRIPTS (Credential Leakage)
236
+ * → .php, .asp, .jsp, .cgi
237
+ * → Reason: Source code exposure (database passwords, API keys, secrets)
238
+ * → Alternative: Static hosting only - use serverless functions for backends
239
+ *
240
+ * 4. SHELL SCRIPTS (OS Execution)
241
+ * → .sh, .bash, .bat, .cmd, .ps1, .vbs
242
+ * → Reason: Execute on user's OS outside browser sandbox, social engineering risk
243
+ * → Alternative: Embed code examples in HTML <pre><code> or link to GitHub repo
244
+ *
245
+ * 5. PROGRAMMING LANGUAGE SOURCE (Platform Scope)
246
+ * → .py, .rb, .pl, .java, .c, .cpp, .cs, .go, .rs
247
+ * → Reason: Not web-renderable, better served by GitHub/GitLab/Bitbucket
248
+ * → Alternative: Use GitHub for code hosting, link to repository
249
+ *
250
+ * 6. OFFICE DOCUMENTS (Macro Malware)
251
+ * → .doc, .docx, .xls, .xlsx, .ppt, .pptx
252
+ * → Reason: Can contain VBA macros, active exploits in the wild
253
+ * → Alternative: Use PDF for documents (fully supported)
254
+ *
255
+ * 7. GENERIC BINARIES (Unvalidatable)
256
+ * → application/octet-stream
257
+ * → Reason: Too broad - allows any binary format, cannot moderate effectively
258
+ * → Alternative: Use specific MIME types for known formats
259
+ *
260
+ * ============================================================================
261
+ * Security Model:
262
+ * - Browser sandbox (JS/WASM execute safely in controlled environment)
263
+ * - AI content moderation (scans text/image content for abuse)
264
+ * - No server-side execution (static files only)
265
+ * - Explicit allowlist (only approved formats, reject unknown)
266
+ * ============================================================================
211
267
  */
212
268
  export const ALLOWED_MIME_TYPES = [
213
- // Common web content (prefix matches)
214
- 'text/', // All text types
215
- 'image/', // All image types
216
- 'audio/', // All audio types
217
- 'video/', // All video types
218
- 'font/', // Modern font types (font/woff, font/woff2, font/ttf, font/otf)
219
- 'model/', // 3D models
220
- // Specific application types (exact matches)
269
+ // =========================================================================
270
+ // TEXT CONTENT (explicit list - no prefix matching for security)
271
+ // =========================================================================
272
+ // Core web documents
273
+ 'text/html', // HTML pages
274
+ 'text/css', // Stylesheets
275
+ 'text/plain', // Plain text (robots.txt, .well-known/*, LICENSE, README.txt)
276
+ 'text/markdown', // Markdown files (.md)
277
+ 'text/xml', // XML files
278
+ // Data formats
279
+ 'text/csv', // CSV data files
280
+ 'text/yaml', // YAML config files
281
+ // Web-specific formats
282
+ 'text/vtt', // WebVTT video subtitles/captions (accessibility)
283
+ 'text/calendar', // iCalendar (.ics) event files
284
+ // JavaScript (legacy MIME type, still widely used by ~50% of servers)
285
+ 'text/javascript',
286
+ // Modern web development formats (uncompiled source)
287
+ 'text/typescript', // TypeScript source (.ts)
288
+ 'text/tsx', // TypeScript JSX (.tsx)
289
+ 'text/jsx', // React JSX (.jsx)
290
+ 'text/x-scss', // SCSS preprocessor
291
+ 'text/x-sass', // Sass preprocessor
292
+ 'text/x-less', // Less preprocessor
293
+ 'text/stylus', // Stylus preprocessor
294
+ 'text/x-vue', // Vue single-file components (.vue)
295
+ 'text/x-svelte', // Svelte components (.svelte)
296
+ // =========================================================================
297
+ // MEDIA (prefix matching - covers all common subtypes)
298
+ // =========================================================================
299
+ // Images: PNG, JPEG, GIF, SVG, WebP, AVIF, HEIC, BMP, TIFF, ICO, etc.
300
+ 'image/',
301
+ // Audio: MP3, OGG, WAV, WebM, AAC, FLAC, Opus, etc.
302
+ 'audio/',
303
+ // Video: MP4, WebM, OGG, QuickTime, etc.
304
+ 'video/',
305
+ // Modern fonts: WOFF2, WOFF, TTF, OTF
306
+ 'font/',
307
+ // =========================================================================
308
+ // CORE WEB APPLICATION TYPES
309
+ // =========================================================================
310
+ // JavaScript (multiple MIME types for compatibility)
311
+ 'application/javascript', // Modern standard (RFC 9239)
312
+ 'application/ecmascript', // ECMAScript (legacy but still used)
313
+ 'application/x-javascript', // Legacy variant (old CDNs, Apache configs)
314
+ // WebAssembly (modern web apps, games, compute-heavy workloads)
315
+ 'application/wasm',
316
+ // JSON and structured data
221
317
  'application/json',
222
- 'application/javascript',
223
- 'application/pdf',
318
+ 'application/ld+json', // JSON-LD for structured data / SEO (Schema.org, Open Graph)
319
+ 'application/manifest+json', // PWA web app manifests
320
+ // Development tools
321
+ 'application/source-map', // Source maps (.js.map, .css.map) for debugging
322
+ // XML and feeds
224
323
  'application/xml',
225
- 'application/manifest+json',
226
- 'application/toml',
227
- // Legacy font MIME types (for Bootstrap, Font Awesome, etc.)
324
+ 'application/xhtml+xml', // XHTML - XML-compliant HTML (legacy sites)
325
+ 'application/rss+xml', // RSS feeds (blogs, podcasts)
326
+ 'application/atom+xml', // Atom feeds
327
+ // Configuration formats
328
+ 'application/yaml', // YAML configs (static site generators)
329
+ // Documents
330
+ 'application/pdf', // PDF documents
331
+ // =========================================================================
332
+ // 3D FORMATS (industry standard only)
333
+ // =========================================================================
334
+ // glTF - Khronos standard for 3D web content
335
+ 'model/gltf+json', // glTF JSON format
336
+ 'model/gltf-binary', // GLB binary format
337
+ // =========================================================================
338
+ // LEGACY COMPATIBILITY
339
+ // =========================================================================
340
+ // Video (some tools detect MP4 as application/mp4)
341
+ 'application/mp4',
342
+ // Legacy font MIME types (Bootstrap, Font Awesome, IE compatibility)
228
343
  'application/font-woff',
229
344
  'application/font-woff2',
230
345
  'application/x-font-woff',
231
346
  'application/x-woff',
232
- 'application/vnd.ms-fontobject', // .eot files (IE compatibility)
347
+ 'application/vnd.ms-fontobject', // EOT files (Internet Explorer)
233
348
  'application/x-font-ttf',
234
349
  'application/x-font-truetype',
235
350
  'application/x-font-otf',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipstatic/types",
3
- "version": "0.4.19",
3
+ "version": "0.4.21",
4
4
  "description": "Shared types for Shipstatic platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/index.ts CHANGED
@@ -506,38 +506,174 @@ export interface ConfigResponse {
506
506
  }
507
507
 
508
508
  /**
509
- * Allowed MIME types and prefixes for file uploads.
509
+ * Allowed MIME types for static web hosting.
510
510
  *
511
511
  * This is a static platform constant, not per-user configuration.
512
512
  * Safe to share across frontend/backend due to atomic deploys.
513
513
  *
514
514
  * Validation rules:
515
515
  * - Exact match: 'application/json' allows only 'application/json'
516
- * - Prefix match: 'text/' allows 'text/plain', 'text/html', etc.
516
+ * - Prefix match: 'image/' allows all image types (png, jpeg, webp, etc.)
517
+ *
518
+ * Coverage: 100% of browser-renderable web content
519
+ * - Core web (HTML, CSS, JS, WASM)
520
+ * - Media (images, audio, video, fonts)
521
+ * - Documents (PDF, Markdown, data formats)
522
+ * - Modern web (PWA, 3D, structured data)
523
+ *
524
+ * ============================================================================
525
+ * INTENTIONALLY EXCLUDED (Security & Platform Integrity)
526
+ * ============================================================================
527
+ *
528
+ * We are a WEB HOSTING platform, not a file distribution service.
529
+ * GitHub Pages-style parity for renderable content, more restrictive for downloads.
530
+ *
531
+ * 1. EXECUTABLES (Malware Distribution)
532
+ * → .exe, .msi, .dmg, .deb, .rpm, .app, .apk, .jar
533
+ * → Reason: Direct malware delivery vector
534
+ * → Alternative: Use GitHub Releases or dedicated software distribution CDN
535
+ *
536
+ * 2. ARCHIVES (Piracy & Abuse)
537
+ * → .zip, .rar, .tar, .gz, .7z, .bz2
538
+ * → Reason: File sharing abuse, can contain executables, no web rendering
539
+ * → Alternative: Use file hosting service (Dropbox, Google Drive) or GitHub Releases
540
+ *
541
+ * 3. SERVER-SIDE SCRIPTS (Credential Leakage)
542
+ * → .php, .asp, .jsp, .cgi
543
+ * → Reason: Source code exposure (database passwords, API keys, secrets)
544
+ * → Alternative: Static hosting only - use serverless functions for backends
545
+ *
546
+ * 4. SHELL SCRIPTS (OS Execution)
547
+ * → .sh, .bash, .bat, .cmd, .ps1, .vbs
548
+ * → Reason: Execute on user's OS outside browser sandbox, social engineering risk
549
+ * → Alternative: Embed code examples in HTML <pre><code> or link to GitHub repo
550
+ *
551
+ * 5. PROGRAMMING LANGUAGE SOURCE (Platform Scope)
552
+ * → .py, .rb, .pl, .java, .c, .cpp, .cs, .go, .rs
553
+ * → Reason: Not web-renderable, better served by GitHub/GitLab/Bitbucket
554
+ * → Alternative: Use GitHub for code hosting, link to repository
555
+ *
556
+ * 6. OFFICE DOCUMENTS (Macro Malware)
557
+ * → .doc, .docx, .xls, .xlsx, .ppt, .pptx
558
+ * → Reason: Can contain VBA macros, active exploits in the wild
559
+ * → Alternative: Use PDF for documents (fully supported)
560
+ *
561
+ * 7. GENERIC BINARIES (Unvalidatable)
562
+ * → application/octet-stream
563
+ * → Reason: Too broad - allows any binary format, cannot moderate effectively
564
+ * → Alternative: Use specific MIME types for known formats
565
+ *
566
+ * ============================================================================
567
+ * Security Model:
568
+ * - Browser sandbox (JS/WASM execute safely in controlled environment)
569
+ * - AI content moderation (scans text/image content for abuse)
570
+ * - No server-side execution (static files only)
571
+ * - Explicit allowlist (only approved formats, reject unknown)
572
+ * ============================================================================
517
573
  */
518
574
  export const ALLOWED_MIME_TYPES = [
519
- // Common web content (prefix matches)
520
- 'text/', // All text types
521
- 'image/', // All image types
522
- 'audio/', // All audio types
523
- 'video/', // All video types
524
- 'font/', // Modern font types (font/woff, font/woff2, font/ttf, font/otf)
525
- 'model/', // 3D models
526
-
527
- // Specific application types (exact matches)
575
+ // =========================================================================
576
+ // TEXT CONTENT (explicit list - no prefix matching for security)
577
+ // =========================================================================
578
+
579
+ // Core web documents
580
+ 'text/html', // HTML pages
581
+ 'text/css', // Stylesheets
582
+ 'text/plain', // Plain text (robots.txt, .well-known/*, LICENSE, README.txt)
583
+ 'text/markdown', // Markdown files (.md)
584
+ 'text/xml', // XML files
585
+
586
+ // Data formats
587
+ 'text/csv', // CSV data files
588
+ 'text/yaml', // YAML config files
589
+
590
+ // Web-specific formats
591
+ 'text/vtt', // WebVTT video subtitles/captions (accessibility)
592
+ 'text/calendar', // iCalendar (.ics) event files
593
+
594
+ // JavaScript (legacy MIME type, still widely used by ~50% of servers)
595
+ 'text/javascript',
596
+
597
+ // Modern web development formats (uncompiled source)
598
+ 'text/typescript', // TypeScript source (.ts)
599
+ 'text/tsx', // TypeScript JSX (.tsx)
600
+ 'text/jsx', // React JSX (.jsx)
601
+ 'text/x-scss', // SCSS preprocessor
602
+ 'text/x-sass', // Sass preprocessor
603
+ 'text/x-less', // Less preprocessor
604
+ 'text/stylus', // Stylus preprocessor
605
+ 'text/x-vue', // Vue single-file components (.vue)
606
+ 'text/x-svelte', // Svelte components (.svelte)
607
+
608
+ // =========================================================================
609
+ // MEDIA (prefix matching - covers all common subtypes)
610
+ // =========================================================================
611
+
612
+ // Images: PNG, JPEG, GIF, SVG, WebP, AVIF, HEIC, BMP, TIFF, ICO, etc.
613
+ 'image/',
614
+
615
+ // Audio: MP3, OGG, WAV, WebM, AAC, FLAC, Opus, etc.
616
+ 'audio/',
617
+
618
+ // Video: MP4, WebM, OGG, QuickTime, etc.
619
+ 'video/',
620
+
621
+ // Modern fonts: WOFF2, WOFF, TTF, OTF
622
+ 'font/',
623
+
624
+ // =========================================================================
625
+ // CORE WEB APPLICATION TYPES
626
+ // =========================================================================
627
+
628
+ // JavaScript (multiple MIME types for compatibility)
629
+ 'application/javascript', // Modern standard (RFC 9239)
630
+ 'application/ecmascript', // ECMAScript (legacy but still used)
631
+ 'application/x-javascript', // Legacy variant (old CDNs, Apache configs)
632
+
633
+ // WebAssembly (modern web apps, games, compute-heavy workloads)
634
+ 'application/wasm',
635
+
636
+ // JSON and structured data
528
637
  'application/json',
529
- 'application/javascript',
530
- 'application/pdf',
638
+ 'application/ld+json', // JSON-LD for structured data / SEO (Schema.org, Open Graph)
639
+ 'application/manifest+json', // PWA web app manifests
640
+
641
+ // Development tools
642
+ 'application/source-map', // Source maps (.js.map, .css.map) for debugging
643
+
644
+ // XML and feeds
531
645
  'application/xml',
532
- 'application/manifest+json',
533
- 'application/toml',
646
+ 'application/xhtml+xml', // XHTML - XML-compliant HTML (legacy sites)
647
+ 'application/rss+xml', // RSS feeds (blogs, podcasts)
648
+ 'application/atom+xml', // Atom feeds
649
+
650
+ // Configuration formats
651
+ 'application/yaml', // YAML configs (static site generators)
652
+
653
+ // Documents
654
+ 'application/pdf', // PDF documents
655
+
656
+ // =========================================================================
657
+ // 3D FORMATS (industry standard only)
658
+ // =========================================================================
659
+
660
+ // glTF - Khronos standard for 3D web content
661
+ 'model/gltf+json', // glTF JSON format
662
+ 'model/gltf-binary', // GLB binary format
663
+
664
+ // =========================================================================
665
+ // LEGACY COMPATIBILITY
666
+ // =========================================================================
667
+
668
+ // Video (some tools detect MP4 as application/mp4)
669
+ 'application/mp4',
534
670
 
535
- // Legacy font MIME types (for Bootstrap, Font Awesome, etc.)
671
+ // Legacy font MIME types (Bootstrap, Font Awesome, IE compatibility)
536
672
  'application/font-woff',
537
673
  'application/font-woff2',
538
674
  'application/x-font-woff',
539
675
  'application/x-woff',
540
- 'application/vnd.ms-fontobject', // .eot files (IE compatibility)
676
+ 'application/vnd.ms-fontobject', // EOT files (Internet Explorer)
541
677
  'application/x-font-ttf',
542
678
  'application/x-font-truetype',
543
679
  'application/x-font-otf',