dangerouslySetInnerHTML is given markup that is not a literal
What it finds
React escapes everything it renders, except what is passed through dangerouslySetInnerHTML, which is inserted as HTML. If any part of that HTML comes from a user, a URL or a server response, it can run script in the page.
Reported are dangerouslySetInnerHTML={{ __html: value }} in JSX and the property dangerouslySetInnerHTML in an object literal, when the value is neither a string literal nor the result of a call whose name says it sanitizes or escapes, such as DOMPurify.sanitize(html).
From the rule's source, react_raw_html.rs.
Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/ts:react-raw-html" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:react-raw-html] reason="..."tx0 explain tx0/ts:react-raw-html shows the same in the terminal. Found a false positive? Report it.