Page MenuHomePhabricator

Move Sanitizer from core into Parsoid
Open, MediumPublic

Description

We have two copies of the Sanitizer class: one in mediawiki core and one in Parsoid.

We should move the core Sanitizer into Parsoid, and then merge its functionality with Parsoid.

Related Objects

Event Timeline

ssastry triaged this task as Medium priority.Mar 17 2020, 4:28 PM
ssastry moved this task from Needs Triage to Tech Debt / Big changes on the Parsoid board.

My idea is to first move the code w/ no changes from core to Wikimedia\Parsoid\Sanitizer\Sanitizer.php, tag & deploy that (bump the composer version), then hollow out the core version so that it only consists of deprecated proxies for the parsoid versions.

Then we can over time merge the Parsoid and core implementations, working inside the Parsoid repo.

My idea is to first move the code w/ no changes from core to Wikimedia\Parsoid\Sanitizer\Sanitizer.php,

Should it be Wikimedia\Parsoid\Core\Sanitizer.php though? Or, if we think it belongs in the root namespace, Wikimedia\Parsoid\Sanitzer.php ... are we expecting more sanitization classes to create a Sanitizer/ namespace?

Another option is to break out the Sanitizer as a library; if it was a parallel PHP/JS library (like wikipeg) then we could perhaps solve some of the Sanitizer-multiplication issues described in T248211: One Sanitizer to Rule Them All and reuse this library in more places.