Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

CVE-2023-33186: Fix topic tooltip cross-site scripting vulnerability.

Anders Kaseorg3ca131743b00
diff --git a/web/src/tippyjs.js b/web/src/tippyjs.js
index 0272e43203d..4bfee8d0fd9 100644
--- a/web/src/tippyjs.js
+++ b/web/src/tippyjs.js
@@ -4,6 +4,7 @@ import tippy, {delegate} from "tippy.js";
import render_message_inline_image_tooltip from "../templates/message_inline_image_tooltip.hbs";
import render_narrow_to_compose_recipients_tooltip from "../templates/narrow_to_compose_recipients_tooltip.hbs";
+import render_narrow_tooltip from "../templates/narrow_tooltip.hbs";
import render_tooltip_templates from "../templates/tooltip_templates.hbs";
import * as compose_recipient from "./compose_recipient";
@@ -189,8 +190,9 @@ export function initialize() {
message_list_tooltip(".tippy-narrow-tooltip", {
delay: LONG_HOVER_DELAY,
onCreate(instance) {
- const content = instance.props.content + $("#narrow-hotkey-tooltip-template").html();
- instance.setContent(parse_html(content));
+ instance.setContent(
+ parse_html(render_narrow_tooltip({content: instance.props.content})),
+ );
},
});
diff --git a/web/templates/narrow_tooltip.hbs b/web/templates/narrow_tooltip.hbs
new file mode 100644
index 00000000000..21b268af65c
--- /dev/null
+++ b/web/templates/narrow_tooltip.hbs
@@ -0,0 +1,2 @@
+{{content}}
+{{tooltip_hotkey_hints "S"}}
diff --git a/web/templates/tooltip_templates.hbs b/web/templates/tooltip_templates.hbs
index c7bdfad96a9..55208191c24 100644
--- a/web/templates/tooltip_templates.hbs
+++ b/web/templates/tooltip_templates.hbs
@@ -2,9 +2,6 @@
{{t 'View user card' }}
{{tooltip_hotkey_hints "U"}}
</template>
-<template id="narrow-hotkey-tooltip-template">
- {{tooltip_hotkey_hints "S"}}
-</template>
<template id="compose_draft_tooltip_template">
{{t 'Drafts' }}
{{tooltip_hotkey_hints "D"}}