Rule Definition
Ensure that users cannot add unchecked HTML string. It helps detect and mitigate certain types of attacks, including Cross Site Scripting (XSS) and data injection attacks.
Remediation
Avoid using the function dangerouslySetInnerHTML
Violation Code Sample
function createMarkup() {
return {__html: 'First · Second'};
}
function MyComponent() {
return <div dangerouslySetInnerHTML={createMarkup()} />;
}
Reference
https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml
CISQ OMG ASCSM-CWE-79, OWASP 2013 A3, 2017 A7 recommendations
Related Technologies
Technical Criterion
ASCSM-CWE-79 - Cross-site Scripting Improper Input Neutralization
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.