From 295a6493260991fb0bf43a39211297cb103cc01b Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Tue, 4 Oct 2022 19:01:16 +0000 Subject: [PATCH] Merge r21894 from trunk to 5.0-stable (#37751). git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@21895 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/wiki_formatting/textile/redcloth3.rb | 2 +- .../lib/redmine/wiki_formatting/textile_formatter_test.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb index dbb919ff1..b935db6b9 100644 --- a/lib/redmine/wiki_formatting/textile/redcloth3.rb +++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb @@ -691,7 +691,7 @@ class RedCloth3 < String def textile_bq( tag, atts, cite, content ) cite, cite_title = check_refs( cite ) - cite = " cite=\"#{cite}\"" if cite + cite = " cite=\"#{htmlesc cite.dup}\"" if cite atts = shelve( atts ) if atts "\t\n\t\t#{content}

\n\t" end diff --git a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb index 30013b837..23f6d7538 100644 --- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb @@ -751,6 +751,13 @@ class Redmine::WikiFormatting::TextileFormatterTest < ActionView::TestCase assert_equal expected.gsub(%r{[\r\n\t]}, ''), to_html(text).gsub(%r{[\r\n\t]}, '') end + def test_should_escape_bq_citations + assert_html_output({ + %{bq.:http://x/"onmouseover="alert(document.domain) Hover me} => + %{
\n\t\t

Hover me

\n\t
} + }, false) + end + private def assert_html_output(to_test, expect_paragraph = true) -- 2.39.5