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 with nh3 #984

Merged
merged 9 commits into from
Feb 8, 2024
Merged

Replace bleach with nh3 #984

merged 9 commits into from
Feb 8, 2024

Conversation

dannypeterson
Copy link
Contributor

@dannypeterson dannypeterson commented Feb 5, 2024

Bleach is deprecated, so migrated to nh3 and pulled tinycss2 validator over from Bleach for sanitizing HTML / CSS to prevent XSS attacks.

The css_sanitizer.py implementation is from the excellent, but deprecated bleach library: https://github.com/mozilla/bleach/blob/f8fb8482687df63d158d6eccfa2a8153ab467367/bleach/css_sanitizer.py

Copy link
Owner

@shapiromatron shapiromatron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job! Made a few minor cleanups:

  • 00a8d8b add a few more tests
  • 7ac2874 remove django type casting
  • b42dc73 remove repeated declaration
  • d994eef move content back to original position

@shapiromatron shapiromatron merged commit 59b6c6b into main Feb 8, 2024
3 checks passed
@shapiromatron shapiromatron deleted the replace-bleach-with-nh3 branch February 8, 2024 16:30
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

Successfully merging this pull request may close these issues.

2 participants