unsloth/studio/frontend/src
Daniel Han 1385b8076e Studio: sandbox SVG previews inside a CSP-locked iframe
Reviewers flagged the inline SVG preview as a regression from the
pre-PR data-URI <img> path: DOMPurify's default SVG profile keeps
<style> tags, style attributes, and <image>/<use> href targets, all
of which now reach the host Studio document because we mount the
sanitized SVG with dangerouslySetInnerHTML. That lets a model
response hide UI with body{display:none}, or beacon to attacker
URLs via <image href=...>.

Fix in two layers so a single regression cannot reopen the hole:

  * Tighten SVG_PURIFY_CONFIG -- FORBID_TAGS adds style, image, use,
    link, meta; FORBID_ATTR drops href, xlink:href, and style. The
    surviving markup can no longer carry inline CSS or external
    resource refs.

  * Move SvgPreview into a sandbox='' iframe (no scripts, no
    same-origin) with a default-src 'none' CSP. Even if a future
    sanitizer pass leaks a URL-bearing attribute, the browser blocks
    the request and the SVG cannot touch parent.document.
2026-05-23 14:00:36 +00:00
..
app studio/frontend: set per-route document.title (#5660) 2026-05-22 05:02:24 -07:00
assets Final cleanup 2026-03-12 18:28:04 +00:00
components Studio: sandbox SVG previews inside a CSP-locked iframe 2026-05-23 14:00:36 +00:00
config feat(studio): add Continued Pretraining (CPT) as a training method (#4677) 2026-05-06 13:38:35 +04:00
features ci: unblock Studio Windows + Linux + Mac smoke (#5741) 2026-05-23 06:59:16 -07:00
hooks studio: engage draft-mtp on vision MTP GGUFs (drop incorrect vision gate) (#5560) 2026-05-18 08:42:55 -07:00
lib studio: fix toast close-button click and light-mode hover (#5597) 2026-05-19 00:55:55 -07:00
shared studio/frontend: make toast and inline error text selectable and copyable (#5506) 2026-05-18 03:47:21 -07:00
stores Update license headers 2026-03-12 17:23:10 +00:00
test-setup Studio: render HTML and SVG fences inline with sandboxed preview tabs 2026-05-23 14:00:36 +00:00
types feat(studio): add Continued Pretraining (CPT) as a training method (#4677) 2026-05-06 13:38:35 +04:00
utils Update license headers 2026-03-12 17:23:10 +00:00
index.css studio: respect prefers-reduced-motion across animations (#5611) 2026-05-19 06:45:36 -07:00
main.tsx chat only with gguf for mac devices (#4300) 2026-03-15 23:20:48 +04:00
speech-recognition.d.ts Update license headers 2026-03-12 17:23:10 +00:00