Visitar URL original
bleach is deprecated; statement on project going forward (2023-01-23) · Issue #698 · mozilla/bleach · GitHub
Skip to content
This repository was archived by the owner on Jun 10, 2026. It is now read-only.
This repository was archived by the owner on Jun 10, 2026. It is now read-only.

bleach is deprecated; statement on project going forward (2023-01-23) #698

Closed

Description

@willkg

Summary

As of now, Bleach is deprecated.

We will continue to support Bleach:

  1. security updates
  2. support for new Python versions
  3. fixes for egregious bugs

I figure that's one release a year or something like that.

Why?

Bleach sits on top of--and heavily relies on--html5lib which is no longer in active development. It is increasingly difficult to maintain Bleach in that context and I think it's nuts to build a security library on top of a library that's not in active development. There are some options (switch to something else, take over html5lib, etc), I don't particularly like any of them. I think instead, someone new should explore the options with a brand new library and a fresh start.

Update: 2026-06-05

Bleach 6.4.0 is the final release of Bleach. There will be no future releases including for Python support or security fixes. Thank you for using and contributing to Bleach!

Activity

  1. pinned this issue on Jan 23, 2023
  2. removed
    untriagedBug reports that haven't been triaged
    on Jan 23, 2023
  3. hugovk commented on Jan 29, 2023

    @hugovk
    Contributor

    Thank you for all your work on Bleach, and for announcing this clearly and with plenty of notice!

  4. Lukas-J commented on Mar 5, 2023

    @Lukas-J

    Hi @willkg ,
    It seems there is some activity going on in html5lib. So maybe not all hope is lost for bleach. Is there any way it could become un-deprecated sometime?

    If not, I'm struggling finding a suitable replacement for bleach to be honest. Does someone have recommendations to safely sanitize html user input?

    Cheers!

  5. g1-1-1 commented on Mar 6, 2023

    @g1-1-1

    Hi @willkg , It seems there is some activity going on in html5lib. So maybe not all hope is lost for bleach. Is there any way it could become un-deprecated sometime?

    If not, I'm struggling finding a suitable replacement for bleach to be honest. Does someone have recommendations to safely sanitize html user input?

    Cheers!

    ammonia has a python binder you can use with similar features + faster speeds

  6. jsocol commented on Jul 31, 2023

    @jsocol
    Contributor

    Thank you, @willkg, for your stewardship of Bleach for so long—much longer than I had it or than I bet you expected to 😅

    And thank you to all of the other contributors over the past dozen years. It's still amazing to me to see how much this project spread and influenced other libraries. nh3/ammonia look like fantastic, fast alternatives built on a rock solid foundation in html5ever.

  7. qyryq commented on Aug 18, 2023

    @qyryq

    What do people think about https://lxml.de/api/lxml.html.clean.Cleaner-class.html ?

    Update: this comment links to docs which says:

    the HTML Cleaner in lxml.html.clean is not considered appropriate for security sensitive environments. See e.g. bleach for an alternative.

    There are 9 CVEs mentioning lxml and 5 of them mention clean.

    The Cleaner class has allow_tags and safe_attrs parameters, so it could be used as an allowlist-based sanitizer, IIUC.

    Web browser developers are also working on https://wicg.github.io/sanitizer-api/. Chromium already has it. And Firefox has it behind a flag (https://caniuse.com/mdn-api_sanitizer). It's obviously far from being a Python package, but if security is our main concern, what is going to be more robust than a sanitizer built into a web browser?

  8. willkg commented on Oct 6, 2023

    @willkg
    MemberAuthor

    Update: I just pushed out Bleach 6.1.0 which drops Python 3.7 support, picks up Python 3.12 support, and fixes a handful of issues. I also closed out a lot of old issues and issues for things we're not going to fix.

    I will continue fixing security issues as they come up.

    Barring anything exciting, I'll probably do the next release when Python releases 3.13.

  9. aclark4life commented on Nov 20, 2023

    @aclark4life

    @willkg Could this library or html5lib-python benefit from any "lifting efforts" as provided by Tidelift? E.g. https://tidelift.com/subscription/pkg/pypi-pillow. I am potentially looking for something new to "lift"… thanks for any info or guidance towards where to put my efforts.

  10. added a commit that references this issue on Nov 29, 2023
  11. kylepollina commented on Feb 24, 2024

    @kylepollina

    As of January 2024 there have been 3 commits to the htlm5lib repo: https://github.com/html5lib/html5lib-python/commits/master/

    The html5lib is not entirely dead

  12. Alex3917 commented on Feb 24, 2024

    @Alex3917

    FWIW, I tried nh3 as a replacement and found it to be unusable. I reported one issue here, but I've also found others that are at least as severe and probably much harder to fix:

    messense/nh3#36

    There also don't seem to be any Python libraries for linkifying HTML documents, only markdown. I understand why maintaining this library is problematic, but the functionality it provides is essential and there doesn't seem to be any viable replacement right now for either sanitization or linkification. I don't know what the right answer is, but wanted to share my experience since I've now put a few hours into trying to find a viable replacement for each set of functionality.

  13. simonw commented on Mar 16, 2024

    @simonw

    html5lib does have active maintainers at the moment: see this discussion thread for details html5lib/html5lib-python#560

  14. MikeHiett commented on Mar 25, 2024

    @MikeHiett

    As @Alex3917 mentions, I've also tried implementing nh3 and the allowlists for tags and attributes does not work as described by the doucmentation for anyone who also may stumble into this problem

  15. 2 remaining items

  16. GertBurger commented on Jul 8, 2025

    @GertBurger

    We migrated to nh3 but ended up migrating back to bleach.

    ammonia (the lib nh3 wraps) is not nearly as featureful as bleach and nh3 doesn't expose all of ammonia's features.

    We'll stick with bleach whilst there isn't a mature alternative 👍 Thanks for the support @willkg

  17. ankit-231 commented on Sep 3, 2025

    @ankit-231

    Hi @willkg , It seems there is some activity going on in html5lib. So maybe not all hope is lost for bleach. Is there any way it could become un-deprecated sometime?

    If not, I'm struggling finding a suitable replacement for bleach to be honest. Does someone have recommendations to safely sanitize html user input?

    Cheers!

    You can use nh3

  18. EmilStenstrom commented on Dec 12, 2025

    @EmilStenstrom

    @willkg Would you be interested in building bleach on top of https://github.com/EmilStenstrom/justhtml/ instead? Would be happy to add features needed to make bleach integration easier.

  19. willkg commented on Dec 12, 2025

    @willkg
    MemberAuthor

    @EmilStenstrom : That looks like a fascinating project! I don't think I'm interested in working on rewriting Bleach on top of JustHTML, but I definitely think it's a good idea for someone else to write a Bleach clone on top of JustHTML. It looks very promising.

  20. EmilStenstrom commented on Dec 13, 2025

    @EmilStenstrom

    @willkg Check!

    I'm thinking of making sanitization part of the API of JustHTML. The main use-case for a HTML parser is people taking random - sometimes user-generated - HTML from the internet and trying to parse stuff from it. The HTML being untrusted should mean they think about security, but I think many don't. Making a HTML parser "safe by default" feels like a good idea.

    Worried about one thing if incorporating something bleach-like into the project: The ongoing maintenance burden. Any tips on how to reduce that as much as possible, perhaps by changing the API surface? Anything you would have done differently?

    Question about tests: A large contribution from this project over the years has been ironing out all the special cases and ways that people tried to break things with adversarial examples. Are you OK with other projects taking the tests and making it their own?

  21. willkg commented on Dec 13, 2025

    @willkg
    MemberAuthor

    I don't have anything off the top of my head regarding maintenance burden, reducing the API surface, or doing things differently. Sorry!

    Regarding using the test code, all code and tests are distributed under the license text here:

    https://github.com/mozilla/bleach/blob/main/LICENSE

    As long as you follow the terms of the license, that's fine by me.

  22. EmilStenstrom commented on Jan 1, 2026

    @EmilStenstrom

    Just for reference, sanitization is now live in JustHTML. I used some bleach tests in the XSS-bench (used for testing the sanitization), with the included license bundled with the tests.

  23. GertBurger commented on Jan 7, 2026

    @GertBurger

    @EmilStenstrom If you are looking at sanitisation then dompurify is kinda the gold standard and matching it would be a great benefit.

  24. barseghyanartur commented on Jan 7, 2026

    @barseghyanartur
  25. niccokunzmann commented on Mar 2, 2026

    @niccokunzmann

    I found this funding option: https://www.herodevs.com/sustainability-fund It might be interesting.

  26. willkg commented on Jun 5, 2026

    @willkg
    MemberAuthor

    Hello all! I released Bleach 6.4.0 which is the last release of Bleach. There will be no future releases including for Python support or security fixes. This is the end.

    Thank you all for using and contributing to Bleach! I wish you the best!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions