Page MenuHomePhabricator

Detect html2wt reqs issued to Parsoid/PHP with data-parsoid blobs generated by Parsoid/JS and issue a HTTP 421
Closed, ResolvedPublic

Description

If Parsoid/PHP gets a html2wt request with a data-parsoid blob generated by Parsoid/JS, we should reject it since we will severely corrupt the page if it went through given that Parsoid/PHP use byte offsets for data-parsoid and Parsoid/JS uses ucs2 offsets.

Fortunately, the fix for T222738: Add annotation about offset-type in the data-parsoid blob adds annotations to the data-parsoid blob which makes this detection simple.

HTTP 421 (Misdirected request) seems like the appropriate response in this case allowing RESTBase to retry with a request to Parsoid/JS instead.

Details

Related Gerrit Patches:

Related Objects

Event Timeline

ssastry triaged this task as High priority.Nov 6 2019, 5:43 PM
ssastry created this task.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 6 2019, 5:43 PM
ssastry renamed this task from Detect html2wt reqs issued to Parsoid/PHP with data-parsoid blobs generated by Parsoid/JS and issue a HTTP 400 to Detect html2wt reqs issued to Parsoid/PHP with data-parsoid blobs generated by Parsoid/JS and issue a HTTP 421.Nov 6 2019, 5:48 PM
ssastry updated the task description. (Show Details)
ssastry moved this task from Backlog to Deployment on the Parsoid-PHP board.Nov 6 2019, 5:53 PM
Arlolra claimed this task.Nov 7 2019, 12:11 AM

Change 549667 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] Return a 421 Misdirected Request if offsetType in incorrect

https://gerrit.wikimedia.org/r/549667

Change 549667 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Return a 421 Misdirected Request if offsetType in incorrect

https://gerrit.wikimedia.org/r/549667

mobrovac closed this task as Resolved.Nov 8 2019, 1:58 PM
mobrovac removed a project: Patch-For-Review.