1.0.0 • Published 6 years ago

filthy-clean v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Filthy

A lightweight, customizable library to sanitize user provided HTML.

The problem

Injecting user provided HTML leaves your app vulnerable to XSS: a malicious user can run arbitrary javascript in your page.

The approach

Instead of running complicated regexps on the html string itself, why not letting the browser handling the parsing instead? document.implementation.createHTMLDocument() allows us to manipulate a DOM element without running any scripts or preloading any resource.

Usage

	const filthy = require('filthy-clean');
	const cleanHtml = filthy(userProvidedHtmlString, options);

Options

Defaults