Skip to content

Commit

Permalink
Merge pull request #748 from tosmolka/tosmolka/747
Browse files Browse the repository at this point in the history
Fix Trusted Types Sink violation with empty input and NAMESPACE
  • Loading branch information
cure53 authored Dec 20, 2022
2 parents 4945074 + 7de86a0 commit 24d2a7f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/purify.js
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,9 @@ function createDOMPurify(window = getGlobal()) {
if (!doc || !doc.documentElement) {
doc = implementation.createDocument(NAMESPACE, 'template', null);
try {
doc.documentElement.innerHTML = IS_EMPTY_INPUT ? '' : dirtyPayload;
doc.documentElement.innerHTML = IS_EMPTY_INPUT
? emptyHTML
: dirtyPayload;
} catch (_) {
// Syntax error if dirtyPayload is invalid xml
}
Expand Down

0 comments on commit 24d2a7f

Please sign in to comment.