@solidxai/core 0.1.17-beta.0 → 0.1.17-beta.1

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.
@@ -541,17 +541,27 @@ import { SwitchNode } from './services/workflow/nodes/switch.node';
541
541
  res.setHeader("X-Content-Type-Options", "nosniff");
542
542
 
543
543
  // Only a small allowlist of media types is ever safe to render inline. Everything
544
- // else (including svg, html, and any other uploaded file) is forced to download
544
+ // else (including html and any other uploaded file) is forced to download
545
545
  // rather than be displayed/executed by the browser, regardless of what mimetype or
546
546
  // extension it was uploaded with.
547
547
  // basename first: getLowercaseFileExtension takes a file name, not a path, so a
548
548
  // directory containing a dot must not be mistaken for the extension. An
549
549
  // extensionless file yields undefined, which is not inline-safe - so it correctly
550
550
  // falls through to the forced-download branch.
551
- if (!INLINE_SAFE_EXTENSIONS.has(getLowercaseFileExtension(basename(path)) ?? '')) {
551
+ const ext = getLowercaseFileExtension(basename(path)) ?? '';
552
+ if (!INLINE_SAFE_EXTENSIONS.has(ext)) {
552
553
  res.setHeader("Content-Type", "application/octet-stream");
553
554
  res.setHeader("Content-Disposition", "attachment");
554
555
  }
556
+
557
+ // svg is only ever inline-safe (see INLINE_SAFE_EXTENSIONS) once it can also render
558
+ // as an active document (<script>, event handlers). <img>/CSS never execute it, but
559
+ // a direct navigation to this URL would - so pin it to a locked-down document: no
560
+ // script, no network, and `sandbox` gives it an opaque origin so even a parser bypass
561
+ // can't reach app cookies or storage.
562
+ if (ext === 'svg') {
563
+ res.setHeader("Content-Security-Policy", "default-src 'none'; style-src 'unsafe-inline'; img-src data:; sandbox");
564
+ }
555
565
  },
556
566
  },
557
567
  }),