Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeprecationWarning: html5lib's sanitizer is deprecated #632

Open
Gpapidas opened this issue Oct 14, 2022 · 11 comments
Open

DeprecationWarning: html5lib's sanitizer is deprecated #632

Gpapidas opened this issue Oct 14, 2022 · 11 comments

Comments

@Gpapidas
Copy link

Hello everyone,

I noticed that djangocms-text-ckeditor is requiring html5lib package which has a deprecated sanitizer.
html5lib recommends switching to bleach

Is this something known? Will there be a fix in a next version?

@mbi
Copy link
Contributor

mbi commented Nov 28, 2022

(Resuming discussion from #469)

After a first brief analysis, this looks considerably more complicated than simply swapping one function call to html5lib with another to bleach. Although bleach itself relies on html5lib, they have a significantly different API.

bleach itself uses html5lib at the moment but is considering forking it for much the same reasons.

Finally, html5lib seems to be used in several places throughout the plugin code, not just for sanitizing. It's unclear to me on whether you'd expect to entirely remove html5lib, or just the sanitizing portions?

All in all, maybe it'd be saner to wait for a decision from the bleach team on how they wish to handle html5lib and then either use their fork (if any is produced) or mimic / adapt what they'll chose to do.

@fsbraun
Copy link
Member

fsbraun commented Nov 29, 2022

@mbi Thanks so much for the analysis. I was not aware of the discussion to fork html5lib.

Since (for now at least) bleach depends on html5lib we could not remove the html5lib dependency anyway and I was expecting to keep both dependencies.

@marksweb What do you think?

@marksweb
Copy link
Member

@fsbraun @mbi I'm happy to wait on a decision.

It'll also then help me consider changes I need to make to django-bleach 😂

@mbi
Copy link
Contributor

mbi commented Feb 16, 2023

Haven't tested it, and can't vouch for its security or capabilities, but html-sanitizer seems like a well-tested and well-supported alternative that doesn't use html5lib.

@gs1-rob-392
Copy link

bleach is deprecated: mozilla/bleach#698

@stale
Copy link

stale bot commented Jul 12, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 12, 2023
@fsbraun fsbraun removed the stale label Jul 12, 2023
@mavoIn
Copy link

mavoIn commented Sep 13, 2023

@corentinbettiol
Copy link

We need to remove html5lib and use html-sanitizer instead.

@MacLake
Copy link
Contributor

MacLake commented Oct 5, 2023

When checking out the deprecation messages of my djangoCMS project, I noticed that djangocms-text-ckeditor still uses html5lib, so I ended up here.

In an issue on the bleach project, switching to nh3 is recommended, nh3 provides Python bindings to the Rust project ammonia (took some time to notice that NH_3 is the chemical formula of ammonia). I’ve been using it for a while without any problems. The only thing is: You can’t sanitize CSS selectively. But it seems that html-sanitizer doesn’t allow any inline styles at all. Anyway, that would be another option instead of using html-sanitizer.

Copy link

stale bot commented Jan 3, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 3, 2024
@MacLake
Copy link
Contributor

MacLake commented Jan 3, 2024

This is the activity bot, the counterpart of the stale bot, reminding that this issue is still relevant!

@stale stale bot removed the stale label Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants