diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb index 2816e1c90..347743105 100644 --- a/lib/redmine/wiki_formatting/textile/redcloth3.rb +++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb @@ -690,7 +690,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" 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 5ee4defe1..28a3d92ab 100644 --- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb @@ -703,6 +703,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} => + %{#{content}
\n\t
\n\t\t} + }, false) + end + private def assert_html_output(to_test, expect_paragraph = true)Hover me
\n\t