Page MenuHomePhabricator

Parsoid clients should handle multi-valued rel attributes
Closed, ResolvedPublic

Description

The "rel" attribute can have multiple values. It was so far essentially mono-valued (for instance, "mw:ExtLink") but, with the introduction of the "nofollow" attributes in links by the parent task, we cannot rely anymore on the fact that it's monovalued.

In particular, the following patterns should be considered carefully:

  • equality comparison of the "rel" attribute with a given string (for instance, rel === 'mw:ExtLink')
  • using the "rel" attribute as a single value in array matching instead of splitting it along the spaces
  • regex comparison of the "rel" attribute in a way that doesn't account for multiple values
  • CSS selectors that look like a[rel="..."] instead of a[rel~="..."]
  • XPath selectors that look like //a[@rel="..."]
  • Setting a "rel" attribute unconditionally with a single value

I've created a common task and tagged all known Parsoid clients. Feel free to create a specific subtask for your own client, if necessary.

Event Timeline

I'm also currently preparing a patch for cxserver - sending that to review within the next hour or so.

Change 823118 had a related patch set uploaded (by Isabelle Hurbain-Palatin; author: Isabelle Hurbain-Palatin):

[mediawiki/services/cxserver@master] Allow for multi-valued rel attribute

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

From my checks, DiscussionTools doesn't seem to be impacted. Double-checking welcome!

Change 823594 had a related patch set uploaded (by Isabelle Hurbain-Palatin; author: Isabelle Hurbain-Palatin):

[mediawiki/services/mobileapps@master] Add spaces around rel attribute checks

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

Change 823597 had a related patch set uploaded (by Isabelle Hurbain-Palatin; author: Isabelle Hurbain-Palatin):

[mediawiki/extensions/Flow@master] Allows for multiple values in the "rel" attribute

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

Arlolra triaged this task as Medium priority.Aug 16 2022, 3:04 PM
Arlolra moved this task from Needs Triage to Feature requests on the Parsoid board.

Change 823594 merged by jenkins-bot:

[mediawiki/services/mobileapps@master] Split the "rel" attribute along whitespace and check for value

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

Change 825345 had a related patch set uploaded (by Isabelle Hurbain-Palatin; author: Isabelle Hurbain-Palatin):

[mediawiki/extensions/Cite@master] Allow multivalued rel attributes

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

Change 825345 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Allow multivalued rel attributes

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

Change 823597 merged by jenkins-bot:

[mediawiki/extensions/Flow@master] Allows for multiple values in the "rel" attribute

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

Change 823118 merged by jenkins-bot:

[mediawiki/services/cxserver@master] Allow for multi-valued rel attribute

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

Change 825746 had a related patch set uploaded (by Isabelle Hurbain-Palatin; author: Isabelle Hurbain-Palatin):

[mediawiki/extensions/VisualEditor@master] Fix a few risky places for a multi-valued rel attributes

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

Change 825746 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Fix a few risky places for a multi-valued rel attributes

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

Change 832989 had a related patch set uploaded (by KartikMistry; author: KartikMistry):

[operations/deployment-charts@master] Update cxserver to 2022-09-15-113346-production

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

Change 832989 merged by jenkins-bot:

[operations/deployment-charts@master] Update cxserver to 2022-09-15-113346-production

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

Mentioned in SAL (#wikimedia-operations) [2022-09-20T07:10:50Z] <kart_> Updated cxserver to 2022-09-15-113346-production (T317289, T315209)