Closed Bug 1346462 Opened 9 years ago Closed 9 years ago

upgrade to Bleach 2.0

Categories

(developer.mozilla.org :: Security, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: willkg, Unassigned)

References

Details

I did a rewrite of Bleach to use html5lib >= 0.99999999 (8 9s). The new release performs better, has a more convenient API and supports current versions of html5lib. CHANGES here: http://bleach.readthedocs.io/en/latest/changes.html#version-2-0-march-8th-2017 MDN is currently using Bleach 1.5. This bug covers upgrading MDN to use Bleach 2.0.
I looked at where Bleach gets used in MDN and I could probably put together a PR. If I spent the time to do that, would someone be able to review it? Are there any "gotchas" I should look out for when working on this?
It will be March 28th before I could review it, and I think I'm the one who would have to. There's is code support for some alternate bleaching contexts, with names like "use_constance_bleach_whitelists" and "bleach_new". I believe these are unused and can be ignored. I don't think our unit tests cover the bleaching very well, so they are necessary but not sufficient. I'd want to sample real content from MDN, sanitize it, and diff the output. The anonymized DB dump in a local dev environment would work.
Ok. That sounds more involved than a "swoop in with a PR" plus it sounds like there's some additional cleanup that could/should happen. My experience so far is that the output didn't change much. The only thing that did change were tag-like things now end up with an end tag and if you're escaping rather than dropping such things, they show up funny. For example: Hi! This is great! </sarcasm> now gets converted to: Hi! This is great! &lt;sarcasm&gt;&lt;/sarcasm&gt; The PR I did for Standup is here if it helps at all: https://github.com/mozilla/standup/pull/379
Depends on: 1328449
Commits pushed to master at https://github.com/mozilla/kuma https://github.com/mozilla/kuma/commit/0012ac04df60749f17ce27e643fc95766748ff8f bug 1346462: Remove ?bleach_new, custom whitelist There was a 2013 effort (bug 833914) to find in-content samples by viewing MDN pages with restrictive whitelists and seeing what fails. Remove this now-unused feature, to simplify the rendering code and prepare for upgrading to Bleach 2.x https://github.com/mozilla/kuma/commit/5d58da829a0a154ab0c165eb901052c0f0452672 Merge pull request #4218 from jwhitlock/no-custom-bleach-1346462 bug 1346462: Remove ?bleach_new, custom whitelist
Commits pushed to master at https://github.com/mozilla/kuma https://github.com/mozilla/kuma/commit/19cfef25414058afad1020635be1a627ee95c9df bug 1346462: Upgrade bleach and dependencies bleach 1.5.0 -> 2.0.0: Rewrite with new interfaces for speed and bug fixes html5lib 1.0b6 -> 1.0b10: Compliant with Encoding Standard, avoid XSS bug, move filters._base to filters.base, invalid and relative URL handling webencodings 0.5.1: New dependency of html5lib * The bleach and html5lib APIs have changed, requiring code changes. * The behaviour of the bleach filter for <script> and <style> has changed as well, so there is slightly different test behaviour, but the output is still safe. * The cleaned output is the same between the two stacks. There is some stale cleaned content in the database. https://github.com/mozilla/kuma/commit/101b0cffe30b828c366b414eb28ecddf1fc589e3 Merge pull request #4237 from jwhitlock/upgrade-bleach-1346462 bug 1346462: Upgrade bleach and dependencies r=willkg, rjohnson
Bleach 2.0 and html5lib 1.0b10 deployed to staging and production.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.