Go to file
2020-04-26 01:17:06 -04:00
img Add basic README 2020-04-26 01:17:06 -04:00
src Clean up sanitizer configs 2020-04-25 22:11:59 -04:00
.gitignore Rename Traverser -> Transformer 2020-04-18 18:34:53 -04:00
build.rs Filtering at-rules by name 2020-03-21 23:12:01 -04:00
Cargo.lock WIP adding css property names to string cache 2020-03-19 14:34:24 -04:00
Cargo.toml WIP adding css property names to string cache 2020-03-19 14:34:24 -04:00
README.md Add basic README 2020-04-26 01:17:06 -04:00

chela: HTML & CSS Sanitizer and Transformer

chela

chela (/ˈkiːlə/ — KEE-LUH) is a program that prunes untrusted HTML and CSS using a whitelist of rules. It is also a library for general-purpose HTML and CSS transforming that allows users to define custom functions that modify the parsed HTML tree node-by-node as it is traversed.

This is still an experimental project. Use in production environments at your own risk.

chela is heavily inspired by the Ruby project sanitize. The goal of chela is to match the ease and usability of sanitize but with the performance and reliability of Rust under the hood. The browser-grade html5ever HTML parser and rust-cssparser are used to parse HTML and CSS respectively.

Why chela?

At the time of writing, ammonia is the most popular and battle-tested HTML sanitization library written in Rust. In most cases, it should be used over this library. However, chela provides sanitization of CSS in addition to HTML, which ammonia does not support. Also, chela allows users to write custom functions to perform more complex transformations that simple whitelist rules cannot support. In this way, chela is more than a sanitization library, but a tool to rapidly perform transformations on HTML and CSS inputs.