-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested mx-reply tags aren't handled properly #14081
Comments
As per the spec;
Read: cannot be nested - https://matrix.org/docs/spec/client_server/r0.6.1#m-room-message-msgtypes If that is unclear, you may wish to open a matrix-doc spec clarification isssue |
Riot-web should still handle invalid data in a way that, at best, doesn't confuse people and, at worse, tricks people into thinking they sent stuff that they didn't. Heck, this could even be considered a security bug. |
If it were to handle it, it'd refuse to render the reply entirely. Parsing these things is intentionally minimalistic for security reasons. |
Except counting won't work because people can always type the word "mx-reply". I'd be inclined to yell at clients which are sending invalid data as they aren't spec compliant. |
I guess also taking the spec at its word, Riot doesn't follow it exactly:
(which would include the nested one) |
I tried telling the RiotX team but then on the spot neither they or I could reproduce |
The spec assumes you have valid data. |
The fix would be to change the regex here https://github.com/matrix-org/matrix-react-sdk/blob/1f1f61377775014dfbe8303eb7d89d3ed6f5c520/src/components/views/elements/ReplyThread.js#L95 to be |
That wouldn't work. Doing such without an xml parser to find the matching closing tag would be a PITA as there is nothing to stop someone having a stray
|
It's better a fix than having it render text as if someone sent it that they didn't send. |
Its better to treat invalid events as invalid events :) |
SO just not show the events at all? sure |
Currently it treats it like a valid event and thus making things even weirder, though. |
In the formatted body such the trailing text would be typically html escaped and be |
fixed by matrix-org/matrix-react-sdk#5006 |
Description
Nested
mx-reply
tags aren't rendered properly - text from inside one of the mx-reply tags is rendered normally as if the person writing the message sent themSteps to reproduce
The person here only replied with "Blub?", yet it also puts "test2" in the body as if they said that, while they didn't.
The reason for the m.relates_to missing in that json dump is that that example was in an e2ee room and thus m.relates_to is in the encrypted content, not the decrypted one.
While the spec (very non-clear, would need to be way clearer on that) doesn't allow nested mx-reply tags, this is handling invalid data improperly and could, at best, confuse someone and, at worse, make someone think that someone said something that they didn't
Version information
The text was updated successfully, but these errors were encountered: