hast-util-sanitize
JSON →hast-util-sanitize is a JavaScript utility designed to make HAST (Hypertext Abstract Syntax Tree) nodes safe by removing potentially dangerous user-generated content, primarily to prevent Cross-Site Scripting (XSS) vulnerabilities. Currently at version 5.0.2, the package is actively maintained as part of the unified ecosystem, with a steady release cadence addressing features and breaking changes. It provides a robust, extensible schema, defaulting to GitHub's sanitation rules, allowing developers to customize allowed elements, attributes, and attribute values. This makes it a crucial tool for applications handling untrusted HTML input, either directly or through higher-level wrappers like rehype-sanitize. Its focus on direct HAST manipulation allows for fine-grained control over the sanitization process.
Traffic · last 30 days ↑50% vs prev 7d
top countries 🇺🇸 United States · 🇨🇦 Canada · 🇳🇴 Norway · 🇫🇷 France · NZ