by philipwhiuk · 11mo ago · 0 comments
With `const clean = DOMPurify.sanitize(input); context.innerHTML = clean;` your linter suddenly needs to do complex code analysis and keep track if each variable passed to `context.innerHTML` is clean or tainted.
https://developer.mozilla.org/en-US/docs/Web/API/Trusted_Typ...
1. <https://pchiusano.github.io/2014-10-11/defensive-writing.htm...>
Doesn't seem obvious unless your dutch.
Especially as the first things I would think obvious is: if breaking the behaviour of innerHTML is not a concern for your software why keep it at all? Delete the property or make it readonly.