![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
@types/dompurify
Advanced tools
The @types/dompurify package provides TypeScript type definitions for DOMPurify, a DOM-only XSS sanitizer for HTML, MathML, and SVG. It allows developers to use DOMPurify in TypeScript projects with type checking and autocompletion features.
Sanitizing HTML strings
This feature allows you to sanitize HTML strings to prevent XSS attacks. The sanitize function removes any malicious code from the input string.
import DOMPurify from 'dompurify';
const cleanHTML = DOMPurify.sanitize('<img src=x onerror=alert(1)//>');
Configuring DOMPurify
This feature allows you to configure DOMPurify to customize the sanitization process, such as specifying which tags are allowed.
import DOMPurify from 'dompurify';
const cleanHTML = DOMPurify.sanitize(dirtyHTML, { ALLOWED_TAGS: ['a', 'p'] });
Hooking into DOMPurify
This feature allows you to add hooks to DOMPurify's sanitization process, enabling you to manipulate nodes or their attributes after sanitization.
import DOMPurify from 'dompurify';
DOMPurify.addHook('afterSanitizeAttributes', (node) => {
// manipulate node attributes after sanitization
});
sanitize-html is an HTML sanitizer that is similar to DOMPurify. It also removes unwanted HTML and protects from XSS attacks but is not limited to the DOM and can be used on the server-side with Node.js.
xss is another package that provides protection against XSS attacks. It includes a range of options for filtering and customizing the sanitization process, similar to DOMPurify, but it has a different API and may have different default settings.
npm install --save @types/dompurify
This package contains type definitions for DOM Purify (https://github.com/cure53/DOMPurify).
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/types-2.0/dompurify
Additional Details
These definitions were written by Dave Taylor http://davetayls.me, Samira Bazuzi https://github.com/bazuzi.
FAQs
Stub TypeScript definitions entry for dompurify, which provides its own types definitions
The npm package @types/dompurify receives a total of 1,347,674 weekly downloads. As such, @types/dompurify popularity was classified as popular.
We found that @types/dompurify demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.