Answer the question
In order to leave comments, you need to log in
Does the dompurify library help prevent xss attacks when using dangerouslySetInnerHTML?
Please tell me, for example, html code comes from the server, you need to render it in react, rendering with dangerouslySetInnerHTML
<div dangerouslySetInnerHTML={{__html: //html который пришел с сервера}} />
<div dangerouslySetInnerHTML={{__html: DOMPurify.sanitize(//html который пришел с сервера)}} />
Answer the question
In order to leave comments, you need to log in
"DOMPurify is a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG".
It was created to prevent XSS attacks related to inserting HTML directly.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question