Usage of vulnerable DOMPurify package

  • Rule ID: javascript_third_parties_dom_purify
  • Languages: javascript
  • Source: dom_purify.yml

Description

For DOMPurify versions less than 2.0.17, there are XSS vulnerabilities when using sanitize without proper configuration

Remediations

Upgrade DOMPurify to version 2.0.17 or greater.

Specify a secure configuration option:

  DOMPurify.sanitize(htmlToSanitize, { RETURN_DOM_IMPORT:true })

or:

  DOMPurify.sanitize(htmlToSanitize, { RETURN_DOM_FRAGMENT: true })

Resources

Associated CWE

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