Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikkel Krautz <mikkel@krautz.dk>2016-01-16 13:06:41 +0300
committerMikkel Krautz <mikkel@krautz.dk>2016-01-31 13:42:15 +0300
commitbd8f92b983f3950500f92ba85051542fa9478474 (patch)
tree0641ef7d374187b8daba2a65713b89e341d87667 /src/mumble/TextToSpeech_unix.cpp
parent56fc9de78a5481e6e7c27c74d7c4b1de4776b246 (diff)
Move HTML filtering to a separate shared class.
And touch up some of its code. LuaMilkshake reports that it is possible to get Murmur to emit HTML even when allowhtml is false. For example via "<br />&lt;b&gt;hello world&lt;/&gt;", which would be translated to "\n<b>hello world</b>" by the previous HTML filtering code. Mumble uses QXmlStreamReader to get each token of an XML document to sanitize it. Unfortunately, QXmlStreamReader isn't just a tokenizer. It has a lot of behind-the-scenes XML logic to handle things such as entities. Entities definitions are read and handled by the QXmlStreamReader itself, and are not emitted to a consumer of QXmlStreamReader. This means that when QXmlStreamReader gives you a piece of 'text' data, it will have already translated any entities in the text and translated them accordingly. This is why LuaMilkshake's example works. It is seemingly not possible to get QXmlStreamReader to avoid handling entities. But I believe we can at least stop it from allow new entities to be defined. The original code already did that -- by wrapping the input XML in a new root tag "<document>". This ensures that an internal DTD cannot be defined, and thus that no new entities can be added. This limits the number of entities we need to handle, to the small list of default entities defined by XML: &quot; &amp; &aps; &lt; &gt;. To ensure that the HTML filter is at least a little bit effective against these injection attacks, we ammend the logic of the HTML filter to attmpt to strip &lt; and &gt; *after* running it through the original QXmlStreamReader-based filter. This ensures that no additional HTML elements can be added via entities.
Diffstat (limited to 'src/mumble/TextToSpeech_unix.cpp')
0 files changed, 0 insertions, 0 deletions