MDL-67637 core_message: only preview lastmessage text if safe to do so

If any html/script tags are found in the text() value, don't display it.
This commit is contained in:
Jake Dallimore 2020-01-08 14:22:48 +08:00 committed by Sara Arjona
parent f914f99a76
commit 4e80934653
3 changed files with 6 additions and 3 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -223,7 +223,10 @@ function(
// If that's not possible, we'll report it under the catch-all 'other media'.
var messagePreview = $(lastMessage.text).text();
if (messagePreview) {
return messagePreview;
// The text value of the message must have no html/script tags.
if (messagePreview.indexOf('<') == -1) {
return messagePreview;
}
}
}