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)