🐛 Bug Fix
- Security / iframe (
editHTMLDocumentMode, stored XSS, CWE-79): withiframe: trueandeditHTMLDocumentMode: truea full HTML document assigned toeditor.valuewas written straight into the live iframe document withdocument.write(), andsafeHTMLwas only applied afterwards. Inline<script>elements andon*handlers therefore executed while the document was being parsed — before the sanitizer could remove them — in an iframe that is same-origin with the host page by default (iframeSandbox: null), so an attacker-supplied document could run script in the host application's origin as soon as another user opened it. The document is now parsed in an inertDOMParserdocument (no browsing context: nothing executes, no sub-resources are fetched), sanitized there via thesafeHTMLevent, and only then adopted into the live iframe document; nodes coming from an inert parser are flagged "already started", so even a<script>the cleaner is configured to keep never executes — the same guaranteeinnerHTMLgives in the regular mode. A partial value (no<html>/<body>) in that mode was also assigned todoc.body.innerHTMLunsanitized beforeclean-htmlran, which fired e.g.<img onerror>; it now goes through the regular sanitized path. Affected all versions witheditHTMLDocumentModethrough 4.14.5. Responsibly reported by @bp0lr (GHSA-w3xv-x3fm-59ph).