feat: consolidate HTML sanitizing#8471
Merged
Merged
Conversation
Drops <meta charset="utf-8"> addition after cleaning.
Member
Author
NGPixel
previously approved these changes
Jan 27, 2025
Member
|
Python code looks pythony enough |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8471 +/- ##
=======================================
Coverage 88.80% 88.80%
=======================================
Files 312 312
Lines 40886 40856 -30
=======================================
- Hits 36308 36284 -24
+ Misses 4578 4572 -6 ☔ View full report in Codecov by Sentry. |
rjsparks
approved these changes
Jan 28, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This drops
lxml.html.clean.Cleaner, which was used for sanitizing uploaded HTML, instead using bleach for all sanitizing. Refactors the organization of bleach settings, moving all the cleaning intoietf.utils.htmland leaving only linkify-related settings inietf.utils.text.This refactor drops code that added a
<meta charset="utf-8">to the<head>when the latter was present in a cleaned upload. It probably also did away with some incidental cleanup thatlxmlwas doing for us under some circumstances. One example I came across was that a test clean ofbecame
This only happened in some code paths and was neither tested nor documented, so I don't think it's a big loss. If we need that level of cleanup, we should add it as a proper feature.