Repository navigation
fix(ui): inert HTML parsing in stripHtml/isEmptyHtml (ui 0.7.2) - #21
Merged
Merged
Conversation
…tyHtml (#20) innerHTML on an element of the live document loads images and runs inline handlers (<img onerror>), even when detached. DOMParser documents execute and fetch nothing. Behaviour otherwise unchanged. Bump ui to 0.7.2; move the released 0.7.1 notes out of [Unreleased]. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #20
stripHtmlandisEmptyHtmlused to parse viainnerHTMLon an element of the live document. The browser loads images there and runs inline handlers, so<img src=x onerror=…>executed even on a detached element. They now parse in an inertDOMParserdocument, where nothing runs or loads.isEmptyHtmldetects images through the parsed body instead of a regex.html.ts, which claimed that nothing is executed.[Unreleased]into their own section.Verified in Ausleihbar with a local tgz, calling the functions in the browser:
<img onerror>payloadstripHtml('<p>Hallo <b>Welt</b> & mehr</p>…')"Hallo Welt & mehr"isEmptyHtml('<p></p>'),isEmptyHtml('<p><br></p>'),isEmptyHtml(null)trueisEmptyHtml('<p>x</p>'),isEmptyHtml('<p><img …></p>')falsetscand build clean. The UI package has no test setup.🤖 Generated with Claude Code