qmetrics.net

xss

Whitelist-based HTML sanitizer for XSS prevention

xss screenshot

The xss module filters untrusted HTML using configurable tag and attribute whitelists. It runs on Node.js, in browsers, and includes a command-line processor.

Overview

xss is a library for sanitizing user-supplied HTML to reduce cross-site scripting risk. It accepts HTML input and removes or escapes tags and attributes that are not permitted by a whitelist you define, with optional custom handlers for matched or ignored elements.

Configuration covers default and custom whitelists, hooks for tags and attributes, HTML and attribute escaping, CSS filtering when style is allowed, stripping of disallowed tags or tag bodies, and optional comment removal. It can return sanitized markup alone or, through a variant API, both the cleaned HTML and a list of removed elements.

The same core logic is exposed for server-side Node.js use, browser script inclusion with shim or AMD loading, and a CLI that processes files or interactive stdin input. Documentation positions it for sites that let users submit formatted HTML, such as forums, blogs, and shops.

Compared with other validators mentioned in the project materials, maintainers publish benchmark figures showing higher throughput for this module on sample test code. Extension points include FilterXSS instances with persistent options and integration with a separate cssfilter module for style values.

Key features

  • Configurable HTML tag whitelist
  • Custom tag and attribute handlers
  • CSS filtering for style attributes
  • Strip or escape disallowed tags
  • Browser and Node.js APIs
  • Command-line file processing
  • Removed-element reporting option
  • HTML comment filtering

Use cases

  • Sanitizing forum or blog user HTML
  • Filtering rich text in web applications
  • Batch cleaning HTML files via CLI
  • Client-side XSS mitigation in browsers
  • Controlled formatting in e-commerce content

Similar software

DOMPurify

Browser XSS sanitizer for HTML, SVG, and MathML

A JavaScript sanitizer that strips dangerous markup from HTML, SVG, and MathML strings before they reach the DOM. It runs in modern browsers and can be used with Node.js when a DOM implementation is present.

★ 17.6k⟳ 4 days agoApache-2.0
Application SecurityDesktop/CLI app

JavaScript obfuscator

JavaScript and Node.js source code obfuscator

A package that rewrites JavaScript to hinder reverse engineering, with local transforms, CLI batching, and optional cloud VM obfuscation.

★ 16.4k⟳ todayBSD-2-Clause
Application SecurityDesktop/CLI app

Helmet

HTTP security headers middleware for Node apps

Helmet is middleware that sets HTTP response headers for Node and Express applications. A default install applies multiple security-related headers with options to tune or disable each one.

★ 10.8k⟳ 5 days agoMIT
Application SecurityDesktop/CLI app

bcrypt-ruby

Ruby bindings for OpenBSD bcrypt password hashing

bcrypt-ruby wraps the OpenBSD bcrypt algorithm so Ruby applications can store and verify secure password hashes.

★ 2k⟳ 8 months agoMIT
Application SecurityDesktop/CLI app

obfus.h

Compile-time polymorphic obfuscation header for C on Windows

obfus.h is a single C header that adds compile-time polymorphic obfuscation to TinyCC builds on Windows x86 and x64 native code.

★ 1.9k⟳ yesterdayMIT · open core
Application SecurityDesktop/CLI app

No CAPTCHA reCAPTCHA

Laravel integration for Google reCAPTCHA widgets and validation

No Captcha is a Laravel package that renders Google reCAPTCHA on forms and validates responses server-side. It supports default, themed, and invisible challenge widgets.

★ 1.8k⟳ 9 months agoMIT
Application SecurityDesktop/CLI app