Merge pull request #12166 from erik-krogh/more-html-san

JS: add `HtmlSanitizer` as a sanitizer DOMBasedXss
This commit is contained in:
Erik Krogh Kristensen
2023-02-14 14:09:56 +01:00
committed by GitHub
2 changed files with 9 additions and 0 deletions

View File

@@ -287,6 +287,8 @@ module DomBasedXss {
private class IsEscapedInSwitchSanitizer extends Sanitizer, Shared::IsEscapedInSwitchSanitizer { }
private class HtmlSanitizerAsSanitizer extends Sanitizer instanceof HtmlSanitizerCall { }
/**
* Holds if there exists two dataflow edges to `succ`, where one edges is sanitized, and the other edge starts with `pred`.
*/

View File

@@ -139,4 +139,11 @@ const cashDom = require("cash-dom");
const src = document.getElementById("#link").src;
cash("#id").html(src); // NOT OK.
cashDom("#id").html(src); // NOT OK
var DOMPurify = {
sanitize: function (src) {
return src; // to model spuriously finding an edge. The below is still OK.
}
};
cashDom("#id").html(DOMPurify ? DOMPurify.sanitize(src) : src); // OK
})();