Page MenuHomePhabricator

Echo notification emails are sanitized strangely
Open, NormalPublic

Description

Things that need escaping seem to be getting removed entirely in talk page notification emails.

For instance, the email for https://www.mediawiki.org/w/index.php?title=User_talk:Emufarmers&diff=1037143&oldid=1037136 consisted of:
Jack Phoenix left a message on your talk page in "|".
So I heard that orange is your favorite color, especially when wrapped in a nice little that has class="usermessage"... --


Version: unspecified
Severity: normal

Details

Reference
bz66630

Related Objects

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:12 AM
bzimport added a project: Notifications.
bzimport set Reference to bz66630.
bzimport added a subscriber: Unknown Object (MLST).

Can you upload or forward me the raw email?

Notification email

Attached:

I believe Echo has its own parser. It looks like there are two distinct issues here:

  • in the message body text, "<code>&lt;div&gt;</code>" is getting stripped for some reason
  • the parser is eating the ":" in the ":|" subject line

It probably makes sense to add parser tests for these issues and then fix them. Tentatively adding good first bug.

MZMcBride renamed this task from Notification emails are sanitized strangely to Echo notification emails are sanitized strangely.Dec 8 2014, 5:26 AM
MZMcBride set Security to None.
MZMcBride added a subscriber: Emufarmers.
Mattflaschen-WMF triaged this task as Normal priority.Dec 9 2014, 9:59 PM
Legoktm moved this task from Backlog to Needs code on the Notifications board.Jul 6 2015, 8:20 AM
Restricted Application added a project: Collaboration-Team-Triage. · View Herald TranscriptJul 6 2015, 8:20 AM
Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptMay 5 2016, 4:09 PM

Checked in betalabs with the original text.

the parser is eating the ":" in the ":|" subject line

It's still true.

Apart from not dispalying ":" in a title, Echo notification and email look OK to me. @SBisson can you confirm?

So, the following text

== :| ==

Test! —[[User:Emufarmers|Emufarmers]]<sup>([[User talk:Emufarmers|T]]|
[[Special:Contributions/Emufarmers|C]])</sup> 23:39, 14 June 2014 (UTC)

:So I heard that orange is your favorite color, especially when wrapped in a 
nice little <code>&lt;div&gt;</code> that has <code>class="usermessage"
</code>... --[[User:Jack Phoenix|Jack Phoenix]] <sub>([[User talk:Jack 
Phoenix|Contact]])</sub> 23:54, 14 June 2014 (UTC)

will result in

The email received (user names were modified) :

The echo notification came out as:

I think :| is the text of the header. The colon shouldn't be interpreted as indentation and removed.

The problem is probably with EchoDiscussionParser.

I think :| is the text of the header. The colon shouldn't be interpreted as indentation and removed.
The problem is probably with EchoDiscussionParser.

I think it's because we parse the section title in isolation, and some syntax like : only works at the start of a line.

jmatazzoni closed this task as Resolved.May 26 2016, 6:31 PM
jmatazzoni claimed this task.
jmatazzoni added a subscriber: jmatazzoni.

so are we OK wi

so are we OK wi

?

Are we OK with the anomalies described? They all sound pretty edge-case. Can I leave this closed?

Are we OK with the anomalies described? They all sound pretty edge-case. Can I leave this closed?

Yeah, it's probably fine.

MZMcBride reopened this task as Open.May 31 2016, 9:32 PM

Huh? Unless this issue has been fixed, please leave it open.

Huh? Unless this issue has been fixed, please leave it open.

Sorry, I thought this was part of a larger bug, but instead this task is just about == :| ==.

This bug happens because the section title is extracted and parsed on its own. This means the : is now at the beginning of the line, which gives it special meaning (indent). You'll probably see similar issues with == *foo == because * at the beginning of a line starts a bullet list.

I don't know what in MW core we could possibly use to work around this; perhaps we could call the code that generates section links in edit summaries?

jmatazzoni removed jmatazzoni as the assignee of this task.Jun 1 2016, 1:04 AM