From 59df248f00e3dd2dc84fa1cbe5a1c685cd88dea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Fern=C3=A1ndez-Capel?= Date: Tue, 14 May 2024 16:05:12 +0100 Subject: [PATCH] Backport tests for CVE-2024-34341 to v1.3 --- test/src/system/pasting_test.coffee | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/src/system/pasting_test.coffee b/test/src/system/pasting_test.coffee index b08f5d94a..32696f325 100644 --- a/test/src/system/pasting_test.coffee +++ b/test/src/system/pasting_test.coffee @@ -53,6 +53,34 @@ testGroup "Pasting", template: "editor_empty", -> delete window.unsanitized done() + test "paste unsafe html with noscript", (done) -> + window.unsanitized = [] + pasteData = + "text/plain": "x", + "text/html": """ +
+ """ + + pasteContent pasteData, () -> + after 20, () -> + assert.deepEqual(window.unsanitized, []) + delete window.unsanitized + done() + + test "paste data-trix-attachment unsafe html", (done) -> + window.unsanitized = [] + pasteData = + "text/plain": "x", + "text/html": """ + copy
me + """ + + pasteContent pasteData, -> + after 20, -> + assert.deepEqual window.unsanitized, [] + delete window.unsanitized + done() + test "prefers plain text when html lacks formatting", (expectDocument) -> pasteData = "text/html": "a\nb"