ThinkFacility Sign in
  1. Home
  2. Security
  3. npm package (dompurify)
Highnpm package (dompurify)

DOMPurify before 3.5.0: SAFE_FOR_TEMPLATES can be bypassed for cross-site scripting, update now

Web developers who clean user-submitted HTML with DOMPurify's SAFE_FOR_TEMPLATES option and then hand it to Vue or AngularJS templates.

How to fix it

You haveUpdate to
< 3.5.0→3.5.0

Check your version

Which version your project has
npm ls dompurify

Update

In your project
npm update dompurify
npm ls dompurify
Still old? A dependency pins it
npm explain dompurify
Then check what's left
npm audit

With SAFE_FOR_TEMPLATES on, a nested form tag let sanitized output turn back into a live {{ }} expression once it hit innerHTML. Vue 3 in-DOM templates and AngularJS then ran the attacker's code. Apps that don't compile sanitized HTML as a template aren't hit.

If npm ls still shows an old version under another package, update that package, or add an "overrides" entry for this one in package.json.

Sources