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

Replace Bleach by NH3 #90

Open
obi-081 opened this issue Feb 15, 2023 · 9 comments
Open

Replace Bleach by NH3 #90

obi-081 opened this issue Feb 15, 2023 · 9 comments

Comments

@obi-081
Copy link

obi-081 commented Feb 15, 2023

Since Bleach 6.0 will be the last release and we want the awesome Django Bleach to stay in alive...

Bleach could perhaps be replaced by HN3 ?
https://github.com/messense/nh3

NH3 is the Python Binding for Ammonia.
Ammonia is a whitelist-based HTML sanitization library.
Ammonia is written in Rust and a little Benchmark showed 15x faster performance.
https://github.com/rust-ammonia/ammonia

Looks like they were inspired by Bleach to do it, it could be our solution, what do you think ? ^_^

@marksweb
Copy link
Owner

@obi-jerome That sounds promising. I've not come across that library before.

I was going to update to bleach 6 recently, but not had time given the fact they changed all the kwargs from lists to sets. Bit of a bigger job that I was hoping for to support their last release.

It'd be a bit more work, but just considering a new app, like django-nh3 or something. Just to be explicit.

@obi-081
Copy link
Author

obi-081 commented Feb 15, 2023

Yeah, I was thinking about a new app too.
It would be less risky because you can't know what to expect from NH3 and... well. it's called Django-Bleach. :)
If the transition is simple for those who use Django Bleach right now, it's the best option indeed.

@baseplate-admin
Copy link

baseplate-admin commented Mar 1, 2023

Hello guys,

In my opinion lets make a new app djagno-nh3 and point somewhere in the README that people should switch to django-nh3

@marksweb
Copy link
Owner

marksweb commented Mar 1, 2023

I'll setup a repo with some basics in it.

@marksweb
Copy link
Owner

marksweb commented Mar 1, 2023

Here we go;

https://github.com/marksweb/django-nh3

@baseplate-admin
Copy link

I will give you the first star!! ★

@obi-081
Copy link
Author

obi-081 commented Mar 7, 2023

Awesome ! I'll try this ASAP ! :)

@obi-081
Copy link
Author

obi-081 commented Apr 24, 2023

I wanted to test it, but there's no models.py in it, only the forms.py.
I wanted to try the models.py.
I'll try to make a pull request if I can when I have the time.

@marksweb
Copy link
Owner

@obi-jerome Yeah I've not had time to create the model field just yet.

I did start - but it's been a little while so I can't remember where I got to. Perhaps branch from here;

https://github.com/marksweb/django-nh3/tree/feat/model-field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants