awesome-repositories.com
Blog
MCP
awesome-repositories.com

Entdecke die besten Open-Source-Repositories mit KI-gestützter Suche.

EntdeckenKuratierte SuchenOpen-Source-AlternativenSelf-hosted SoftwareBlogSitemap
ProjektÜber unsRanking-MethodikPresseMCP-Server
RechtlichesDatenschutzAGB
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·
rgrove avatar

rgrove/sanitize

0
View on GitHub↗
2,055 Stars·145 Forks·Ruby·MIT·5 Aufrufe

Sanitize

Sanitize is a Ruby library designed to clean untrusted HTML and CSS input by enforcing strict security policies. It functions as a web input validator and security filtering tool, processing HTML fragments or full documents to remove unauthorized elements, attributes, and dangerous code patterns that could lead to cross-site scripting or injection attacks.

The library distinguishes itself through a tree-based traversal mechanism that evaluates document structures against customizable allowlists. Beyond standard filtering, it provides granular control over content by allowing developers to inject custom logic for node transformation and URL validation. This enables the application of tailored security policies that can accommodate specific formatting requirements while maintaining a secure output.

The project covers a comprehensive range of sanitization capabilities, including the recursive parsing of style declarations to prevent CSS injection and the reconstruction of sanitized content through document fragment serialization. Developers can configure parsing behavior and define custom rules to balance security needs with the desired level of markup support.

Features

  • HTML Sanitization - Prevents cross-site scripting attacks by stripping malicious elements and attributes from user-provided HTML content before rendering.
  • HTML Allowlists - Enforces security by explicitly permitting only known safe HTML elements and attributes while discarding all other unrecognized input.
  • CSS Injection Preventers - Cleans style attributes and stylesheets to ensure that embedded CSS properties do not contain dangerous or unauthorized code.
  • HTML Element Transformers - Applies specialized logic to inspect or modify specific HTML elements during the sanitization process for complex content requirements.
  • Sanitization Callbacks - Provides hooks for developers to inject custom logic to modify or inspect specific nodes during the sanitization traversal.
  • HTML Fragment Serializers - Reconstructs sanitized content by converting the modified tree structure back into a clean string format for safe output.
  • HTML Node Transformers - Executes custom logic on specific HTML nodes during sanitization to perform complex filtering or modifications beyond standard allowlist checks.
  • Embedded URL Validators - Checks and filters URLs found within HTML attributes or CSS imports to ensure they point to trusted and safe locations.
  • DOM Tree Traversers - Processes HTML by walking a hierarchical document object model to evaluate each element against a defined security policy.
  • CSS Sanitizers - Parses and cleans CSS properties and at-rules within style attributes or stylesheets to prevent malicious injection attacks.
  • Customizable Sanitization Rules - Allows developers to create tailored security policies by merging or overriding default allowlists to permit specific elements and attributes.
  • Document Security Sanitizers - Processes complete HTML documents including doctype definitions to ensure the entire structure adheres to established security policies.
  • HTML Input Validators - Processes untrusted HTML fragments and full documents to ensure they conform to safe, predefined structural standards.
  • HTML Security Policy Enforcers - Enforces standard sets of HTML and CSS restrictions ranging from minimal text-only output to permissive formatting and media support.
  • Resource URL Validations - Enforces security policies on embedded resource URLs within HTML and CSS to prevent unauthorized external loading or malicious injection.
  • Web Content Security Filters - Enforces security policies on web content by stripping unauthorized elements, attributes, and dangerous CSS properties.
  • CSS Style Parsers - Deconstructs style declarations into individual properties and rules to validate them against strict safety constraints before reassembly.

Star-Verlauf

Star-Verlauf für rgrove/sanitizeStar-Verlauf für rgrove/sanitize

KI-Suche

Entdecke weitere awesome Repositories

Beschreibe in einfachen Worten, was du brauchst — die KI bewertet tausende kuratierte Open-Source-Projekte nach Relevanz.

Start searching with AI

Open-Source-Alternativen zu Sanitize

Ähnliche Open-Source-Projekte, sortiert nach der Anzahl der gemeinsamen Funktionen mit Sanitize.
  • microcosm-cc/bluemondayAvatar von microcosm-cc

    microcosm-cc/bluemonday

    3,688Auf GitHub ansehen↗

    bluemonday is a Go library for scrubbing user-generated HTML content to prevent cross-site scripting and other injection attacks. It functions as an HTML policy engine and sanitizer that removes dangerous scripts and malicious tags by applying configurable element and attribute allowlists. The project distinguishes itself through a rule-based system that utilizes regular expressions and name-based lists to define permitted tags, attributes, and CSS styles. It includes a URL security validator that enforces safe protocols and automatically injects security attributes such as nofollow and noope

    Goallowlistgogolang
    Auf GitHub ansehen↗3,688
  • leizongmin/js-xssAvatar von leizongmin

    leizongmin/js-xss

    5,319Auf GitHub ansehen↗

    js-xss is an HTML XSS sanitizer and whitelist-based HTML filter designed to remove malicious code from untrusted HTML. It serves as a tool for cross-site scripting prevention and user-generated content management by cleaning HTML strings to ensure safe browser rendering. The library includes a CSS style validator to scrub inline styles against a whitelist and an HTML content purifier capable of stripping all tags to extract raw text. It allows for custom HTML filtering through the definition of specific rules and handler functions to control permitted elements and attributes. The tool covers

    HTML
    Auf GitHub ansehen↗5,319
  • apostrophecms/sanitize-htmlAvatar von apostrophecms

    apostrophecms/sanitize-html

    4,129Auf GitHub ansehen↗

    This is an HTML sanitization library designed to remove dangerous tags and attributes from user-submitted HTML to prevent cross-site scripting attacks. It functions as a content filter that whitelists specific elements and attributes while escaping or discarding unauthorized markup. The project includes an HTML transformation engine that allows for the modification or replacement of tags and attributes using custom logic. It also features a CSS style validator to clean inline properties against permitted patterns and a system for resource URL validation to restrict hostnames and schemes. The

    JavaScript
    Auf GitHub ansehen↗4,129
  • symfony/templatingAvatar von symfony

    symfony/templating

    1,021Auf GitHub ansehen↗

    This library provides a framework for building custom template systems and rendering dynamic content within web applications. It offers a set of standardized interfaces and tools designed to handle the parsing of template files, the transformation of data into structured output, and the management of template loading from various storage locations. The component distinguishes itself through a modular architecture that supports incremental output streaming, which processes content in chunks to reduce memory usage and improve response times. It also includes integrated security features that au

    PHPcomponentphpsymfony
    Auf GitHub ansehen↗1,021
Alle 29 Alternativen zu Sanitize anzeigen→

Kuratierte Suchen mit Sanitize

Handverlesene Sammlungen, in denen Sanitize vorkommt.
  • Injection prevention guide

Häufig gestellte Fragen

Was macht rgrove/sanitize?

Sanitize is a Ruby library designed to clean untrusted HTML and CSS input by enforcing strict security policies. It functions as a web input validator and security filtering tool, processing HTML fragments or full documents to remove unauthorized elements, attributes, and dangerous code patterns that could lead to cross-site scripting or injection attacks.

Was sind die Hauptfunktionen von rgrove/sanitize?

Die Hauptfunktionen von rgrove/sanitize sind: HTML Sanitization, HTML Allowlists, CSS Injection Preventers, HTML Element Transformers, Sanitization Callbacks, HTML Fragment Serializers, HTML Node Transformers, Embedded URL Validators.

Welche Open-Source-Alternativen gibt es zu rgrove/sanitize?

Open-Source-Alternativen zu rgrove/sanitize sind unter anderem: microcosm-cc/bluemonday — bluemonday is a Go library for scrubbing user-generated HTML content to prevent cross-site scripting and other… leizongmin/js-xss — js-xss is an HTML XSS sanitizer and whitelist-based HTML filter designed to remove malicious code from untrusted HTML.… apostrophecms/sanitize-html — This is an HTML sanitization library designed to remove dangerous tags and attributes from user-submitted HTML to… symfony/templating — This library provides a framework for building custom template systems and rendering dynamic content within web… tencent/cherry-markdown — Cherry Markdown is a web-based Markdown editor and parsing engine that converts markup text into sanitized HTML with a… jhy/jsoup — Jsoup is a Java library designed for parsing, extracting, and manipulating HTML and XML content. It provides a…