Insecure use of DOMPurify detected.
- Rule ID: javascript_third_parties_dom_purify
- Languages: javascript
- Source: dom_purify.yml
Description
There are XSS vulnerabilites when using DOMPurify's sanitize without proper configuration
Remediations
Specify a secure configuration option:
DOMPurify.sanitize(htmlToSanitize, { RETURN_DOM_IMPORT:true })
or:
DOMPurify.sanitize(htmlToSanitize, { RETURN_DOM_FRAGMENT: true })
Resources
Associated CWE
OWASP Top 10
Configuration
To skip this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --skip-rule=javascript_third_parties_dom_purify
To run only this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --only-rule=javascript_third_parties_dom_purify
Ready to take the next step? Learn more about Bearer Cloud.