aboutsummaryrefslogtreecommitdiff
path: root/src/services/entity_normalizer
diff options
context:
space:
mode:
authorrinpatch <rin@patch.cx>2021-11-16 19:49:01 +0300
committerrinpatch <rin@patch.cx>2021-11-16 20:35:23 +0300
commitd36b45ad436fbbb027bfe6af1093107c0bfed61f (patch)
tree41345d8de46f32bac9383ffbf182827e7eb5c970 /src/services/entity_normalizer
parentef5bbc4e5f84bb9e8da76a0440eea5d656d36977 (diff)
entity_normalizer: Escape name when parsing user
In January 2020 Pleroma backend stopped escaping HTML in display names and passed that responsibility on frontends, compliant with Mastodon's version of Mastodon API [1]. Pleroma-FE was subsequently modified to escape the display name [2], however only in the "name_html" field. This was fine however, since that's what the code rendering display names used. However, 2 months ago an MR [3] refactoring the way the frontend does emoji and mention rendering was merged. One of the things it did was moving away from doing emoji rendering in the entity normalizer and use the unescaped 'user.name' in the rendering code, resulting in HTML injection being possible again. This patch escapes 'user.name' as well, as far as I can tell there is no actual use for an unescaped display name in frontend code, especially when it comes from MastoAPI, where it is not supposed to be HTML. [1]: https://git.pleroma.social/pleroma/pleroma-fe/-/merge_requests/1052 [2]: https://git.pleroma.social/pleroma/pleroma/-/merge_requests/2167 [3]: https://git.pleroma.social/pleroma/pleroma-fe/-/merge_requests/1392
Diffstat (limited to 'src/services/entity_normalizer')
-rw-r--r--src/services/entity_normalizer/entity_normalizer.service.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js
index 04bb45a4..7025d803 100644
--- a/src/services/entity_normalizer/entity_normalizer.service.js
+++ b/src/services/entity_normalizer/entity_normalizer.service.js
@@ -55,8 +55,9 @@ export const parseUser = (data) => {
}
output.emoji = data.emojis
- output.name = data.display_name
- output.name_html = escape(data.display_name)
+ output.name = escape(data.display_name)
+ output.name_html = output.name
+ output.name_unescaped = data.display_name
output.description = data.note
// TODO cleanup this shit, output.description is overriden with source data