Escape chat messages at the server#939
Conversation
Uh, good point. I just tried and they still work. In fact, I think your PR fixes another (hypothetical) problem. Before your PR, |
|
Hmm. Escaping server sided isn‘t really a secure way to fix the issue in my opinion. A quick fix, yes. But not the final way to solve the original problem. |
I assume you are suggesting to handle it on the target client instead? Which remaining security issues do you see after merging this PR? "Just" the general UDP-related spoofing things? |
Yes. Exactly. Send e.g. json to the client, validate that and then display the message.
That's also an issue. I could also imagine that somebody sets a welcome message with "maliscious" html which we do not escape. |
Agreed, but as far as I can see this would require a protocol change/extension. If we were to do that, I guess it would make sense to combine it with some other possible improvements in that area.
Agreed, but I think we will always have to trust the server to a specific level. Clients should not have to trust the server as much as that it could run arbitrary code or something, but regarding the content I think there is nothing one could do. An attempt at comparing it with some other area: Facebook could always impersonate anyone on their platform because they have the required access. No need for any formatting hacks, cross site scripting or anything. They (or here: the Jamulus server) could just change the content. I am more concerned that by now a valid use case for allowing (some) HTML has been mentioned by @passing in #890 (comment). I don't know yet how to keep such things still working. |
@hoffie |
|
OK, can we summarise:
Protection from 2 is not, in my view, the scope of this ticket and shouldn't block adoption of the a solution for a known issue. |
softins
left a comment
There was a problem hiding this comment.
Just tried this out and it works fine, as expected.
| QTime::currentTime().toString ( "hh:mm:ss AP" ) + ") <b>" + | ||
| ChanName.toHtmlEscaped() + | ||
| "</b></font> " + strChatText; | ||
| "</b></font> " + strChatText.toHtmlEscaped(); |
There was a problem hiding this comment.
I assume it works as intended. Should I test it again?
|
BTW: is this already documented in the ChangeLog? |
It appears not. Historically, who added items to the ChangeLog? The contributor of a change, or Volker? EDIT: Looking at the history for ChangeLog, it appears Volker did so himself. If we need contributors to add their own entries, we need to document this in the contribution guidelines. |
Agree. Probably the contributing file must be updated too. |
|
Just merged it and documented it in the changelog. |
PR jamulussoftware#939 disabled HTML usage in chat messages by escaping all user input at the server side for security reasons. There is demand to keep basic text formatting working for sharing lyrics/chords in a sane way. This PR re-enables certain safe tags again to enable such use cases. This works by keeping the existing message escaping, but converting selected safe HTML tags back into their parsable form. To avoid worsening security again, this PR deliberately - does not permit CSS or any color changes which could enable user impersonation, - does not accept any attributes in HTML tags, - does not accept invalid HTML (e.g. start tags without end tags), - does not accept nested HTML tags (except for <br>s within <pre>...</pre>). References: jamulussoftware#1021 jamulussoftware#1524
PR jamulussoftware#939 disabled HTML usage in chat messages by escaping all user input at the server side for security reasons. There is demand to keep basic text formatting working for sharing lyrics/chords in a sane way. This PR re-enables certain safe tags again to enable such use cases. This works by keeping the existing message escaping, but converting selected safe HTML tags back into their parsable form. To avoid worsening security again, this PR deliberately - does not permit CSS or any color changes which could enable user impersonation, - does not accept any attributes in HTML tags, - does not accept invalid HTML (e.g. start tags without end tags), - does not accept nested HTML tags (except for <br>s within <pre>...</pre>). References: jamulussoftware#1021 jamulussoftware#1524

Update my patch to strip HTML from chat messages from #380, as discussed in #890 (@hoffie).
One thing to test with this before merging is that URLs containing
&still get link-ified correctly.