1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-31 11:37:14 +00:00

Escape blockquote citation in textile formatting (#37751).

Patch by Jens Krämer.


git-svn-id: https://svn.redmine.org/redmine/trunk@21894 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu 2022-10-04 18:58:37 +00:00
parent 0ab2bb8647
commit ba635eace9
2 changed files with 8 additions and 1 deletions

View File

@ -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<blockquote#{cite}>\n\t\t<p#{atts}>#{content}</p>\n\t</blockquote>"
end

View File

@ -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} =>
%{<blockquote cite="http://x/&quot;onmouseover=&quot;alert(document.domain)">\n\t\t<p>Hover me</p>\n\t</blockquote>}
}, false)
end
private
def assert_html_output(to_test, expect_paragraph = true)