DOMPurify is a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML, and SVG. DOMPurify is written in JavaScript and works in all modern browsers (Safari, Opera (15+), Internet Explorer (10+), Edge, Firefox, and Chrome - as well as almost anything else using Blink or WebKit). It doesn't break on MSIE6 or other legacy browsers. It either uses a fall-back or simply does nothing.
Questions tagged [dompurify]
43 questions
36
votes
2 answers
Is sanitizing JSON necessary?
I think it's a well-known best practice on the web to mistrust any input. The sentence
"All input is evil."
is probably the most cited quote with respect to input validation. Now, for HTML you can use tools such as DOMPurify to sanitize it.
My…

Golo Roden
- 140,679
- 96
- 298
- 425
32
votes
7 answers
Next.js DOMPurify.sanitize() shows TypeError: dompurify__WEBPACK_IMPORTED_MODULE_6___default.a.sanitize is not a function
I am using DOMPurify.sanitize() inside dangerouslySetInnerHTML={{}} to display innerHtml returned from the database. For initial purpose I'm using getServersideProps() with next-redux-wrapper for this page.
I installed dompurify with: npm i -S…

forest
- 1,312
- 3
- 20
- 47
13
votes
2 answers
How to install, import and use DOMPurify in frontend js file?
This is more of a "can you please confirm this is correct" type of question, as I think I resolved it in the process of writing the question but hopefully it will be of help to other people who are a bit hesitant when it comes to implementing…

user1063287
- 10,265
- 25
- 122
- 218
5
votes
2 answers
How to allow an iframe tag in `dompurify` including all of its attributes
I want dompurify to allow iframe tags, and I add iframe as an exception(ADD_TAGS). But that removes some attributes of it. I want all attributes to be there.