Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 4, 2024 via pnpm

dompurify 3.0.5

DOMPurify is a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG. It's written in JavaScript and works in all modern browsers (Safari, Opera (15+), Internet Explorer (10+), Firefox and Chrome - as well as almost anything else usin
Package summary
Share
0
issues
1
license
1
(MPL-2.0 OR Apache-2.0)
Package created
21 May 2014
Version published
11 Jul 2023
Maintainers
1
Total deps
1
Direct deps
0
License
(MPL-2.0 OR Apache-2.0)

Issues

0
This package has no issues

Licenses

(MPL-2.0 OR Apache-2.0)

Permissive
1 Packages, Including:
dompurify@3.0.5
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of dompurify 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does dompurify do?

DOMPurify is a robust and super-fast JavaScript-based XSS sanitizer. It's primarily designed for HTML, MathML, and SVG handling. Furthermore, it boasts compatibility with all modern browsers, which includes, but is not limited to, Firefox, Chrome, Edge, Safari, and Opera, as well as numerous other browsers that utilize Blink, Gecko, or WebKit. DOMPurify is particularly valuable in preventing HTML-based XSS attacks due to its ability to sanitize and thoroughly clean HTML strings, eradicating any elements containing potentially dangerous HTML.

How do you use dompurify?

To use DOMPurify, it requires simple steps. First, include the DOMPurify script in your website, using either the minified production version or the unminified development version. For instance, you could use:

<script type="text/javascript" src="src/purify.js"></script>

or

<script type="text/javascript" src="dist/purify.min.js"></script>

Once included, you can sanitize your HTML strings. For example:

const clean = DOMPurify.sanitize(dirty);

Where "dirty" is your potentially unsafe (dirty) HTML input and "clean" is the sanitized (clean) HTML result. You can also use it with Angular, as follows:

import * as DOMPurify from 'dompurify';

const clean = DOMPurify.sanitize('<b>hello there</b>');

The sanitized HTML result can then be written into a DOM element using innerHTML or document.write().

Where are the dompurify docs?

For comprehensive documentation on DOMPurify, it highly recommends visiting the DOMPurify GitHub repository. There, you will find a detailed guide on how to use and customize DOMPurify to cater to your needs. The README file contains initial instructions, and further details can be found within the wiki and the demo folders. TypeScript type definitions are also provided at @types/dompurify.