Bleach

Allowlist-based HTML sanitizing library for untrusted text

Library
PyPI
v6.4.0
2,769stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
54/100Fair
Development Activity32
Maintenance16
Community68
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
70/100Good
Architecture72
Code Quality74
Innovation55
Learning Curve80

Bleach is Mozilla’s allowlist-based HTML sanitizer: it escapes or strips markup and attributes that aren’t explicitly permitted, rather than trying to blocklist dangerous patterns. It’s built on html5lib for browser-accurate HTML parsing, so it handles unbalanced or mis-nested tags in untrusted input the same way a real browser would, and it can safely linkify plain text into anchor tags with configurable rel attributes.

As of June 2026, the Bleach maintainers have announced the project is no longer maintained, including for security issues, and point users toward Rust-backed alternatives such as nh3. It remains widely deployed and its source stays available on GitHub, so it’s documented here as-is for teams maintaining existing integrations or evaluating a migration path.

What You Get

  • bleach.clean() for allowlist-based sanitization of tags, attributes, and protocols
  • bleach.linkify() for safely converting plain-text URLs and emails into anchor tags
  • A Cleaner/Linker class-based API for reusable, configured sanitizer instances
  • Optional CSS property sanitization via css_sanitizer.py for inline style attributes
  • Browser-accurate HTML5 parsing (via html5lib) that correctly handles malformed/mis-nested markup

Common Use Cases

  • Sanitizing user-submitted comments, forum posts, or wiki content before rendering as HTML
  • Stripping disallowed tags/attributes from rich-text editor output before storage or display
  • Auto-linkifying plain-text URLs in user content while controlling rel/target attributes
  • Cleaning HTML email bodies before displaying them inline in a web app

Under The Hood

Architecture: bleach/sanitizer.py implements the Cleaner class, which drives an html5lib tree-walker/serializer pipeline configured with allowlists for tags, attributes, and protocols; bleach/linkifier.py implements a separate Linker/LinkifyFilter pass for text-to-anchor conversion, and bleach/html5lib_shim.py vendors compatibility shims over html5lib internals the library depends on directly (the package even vendors a _vendor copy of html5lib to pin exact parsing behavior).

Tech Stack: Pure Python with a hard dependency on html5lib for spec-compliant HTML5 parsing; a vendored copy under bleach/_vendor insulates the sanitizer from upstream html5lib API changes, at the cost of needing to be updated manually for html5lib security fixes — a factor the maintainers cite in their deprecation notice.

Code Quality: Seven dedicated test modules (tests/test_clean.py, tests/test_linkify.py, tests/test_css.py, etc.) exercise allowlist edge cases, malformed-HTML handling, and linkify corner cases; the README explicitly documents a responsible security-disclosure process reflecting its history as a security-critical dependency across the Python web ecosystem.

API Design: The API is intentionally small and function-first — bleach.clean(text, tags=..., attributes=...) and bleach.linkify(text) cover the overwhelming majority of use cases in one call, with the Cleaner/Linker classes available only when an application needs to reuse the same configuration repeatedly without re-specifying allowlists.

Used by 9 apps in this directory

Python
76%
MIT

ArchiveBox

Bookmarks Archiving

28,138

Self-hosted web archiving that saves HTML, PDFs, screenshots, media, and code in open formats you own forever

View details
88
Repo Health
84
Technical
70
Dependency
Built with
Python76%
HTML12%
Updated today
Python
59%
Apache 2.0

argilla

AI Development · Data Engineering

5,081

Collaborate on high-quality AI training data with a self-hosted annotation platform built for LLMs, NLP, and multimodal models.

View details
65
Repo Health
81
Technical
63
Dependency
Built with
Python59%
Jupyter Notebook21%
Updated 2 days ago
Python
68%
Other

AutoGPT

Automation · Productivity · AI Assistants

186,687

Build, deploy, and run autonomous AI agents that automate complex multi-step workflows using a visual block-based graph editor.

View details
93
Repo Health
78
Technical
67
Dependency
Built with
Python68%
TypeScript31%
Updated today
TypeScript
50%
Other

Dify

No Code Platforms · AI Development · Developer Tools

152,883

Visual LLM workflow platform with RAG pipelines, agent capabilities, and model management for building production AI applications.

View details
92
Repo Health
85
Technical
71
Dependency
Built with
TypeScript50%
Python47%
Updated today
HTML
48%
LGPL-2.1

Horilla

Human Resources · ERP

1,330

Open-source HRMS covering recruitment, attendance, payroll, and biometrics in one self-hosted Django application.

View details
88
Repo Health
60
Technical
65
Dependency
Built with
HTML48%
Python35%
JavaScript13%
Updated today
TypeScript
38%
Apache 2.0

Label Studio

AI Development · Data Engineering

28,083

Label Studio is an open-source, multi-type data labeling platform that lets teams annotate images, text, audio, video, and time series data with a configurable XML-based UI and export annotations in formats ready for any ML framework.

View details
93
Repo Health
87
Technical
68
Dependency
Built with
TypeScript38%
JavaScript27%
Python25%
Updated today
Python
61%
GPL 3.0

Paperless-ngx

Bookmarks Archiving

44,394

Turn your paper pile into a searchable digital archive with OCR, AI classification, and automated workflows — all running on your own server.

View details
91
Repo Health
88
Technical
70
Dependency
Built with
Python61%
TypeScript30%
Updated today
Python
53%
AGPL 3.0

Speakr

AI Assistants

3,652

Self-hosted AI transcription with speaker diarization, smart tagging, and multi-user collaboration — your recordings stay on your infrastructure.

View details
82
Repo Health
79
Technical
70
Dependency
Built with
Python53%
HTML26%
JavaScript17%
Updated 1 weeks ago
Python
97%
MPL 2.0

Taiga Back

Project Management · Developer Tools

846

Self-hosted agile project management backend with Scrum, Kanban, issue tracking, and a full REST API — built on Django and PostgreSQL.

View details
68
Repo Health
74
Technical
63
Dependency
Built with
Python97%
Updated 2 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search