Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
4e3fe484
Commit
4e3fe484
authored
Oct 31, 2011
by
Holger Just
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#647] Fix XSS in textile image syntax.
parent
4cea676d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
redcloth3.rb
lib/redcloth3.rb
+1
-1
textile_formatter_test.rb
...nit/lib/redmine/wiki_formatting/textile_formatter_test.rb
+9
-1
No files found.
lib/redcloth3.rb
View file @
4e3fe484
...
...
@@ -936,7 +936,7 @@ class RedCloth3 < String
stln
,
algn
,
atts
,
url
,
title
,
href
,
href_a1
,
href_a2
=
$~
[
1
..
8
]
htmlesc
title
atts
=
pba
(
atts
)
atts
=
" src=
\"
#{
url
}
\"
#{
atts
}
"
atts
=
" src=
\"
#{
htmlesc
url
.
dup
}
\"
#{
atts
}
"
atts
<<
" title=
\"
#{
title
}
\"
"
if
title
atts
<<
" alt=
\"
#{
title
}
\"
"
# size = @getimagesize($url);
...
...
test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
View file @
4e3fe484
...
...
@@ -86,6 +86,14 @@ class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase
)
end
def
test_textile_should_escape_image_urls
# this is onclick="alert('XSS');" in encoded form
raw
=
'!/images/comment.png"onclick=alert('XSS');"!'
expected
=
'<img src="/images/comment.png"onclick=&#x61;&#x6c;&#x65;&#x72;&#x74;&#x28;&#x27;&#x58;&#x53;&#x53;&#x27;&#x29;;&#x22;" alt="" />'
assert_html_output
(
raw
=>
expected
)
end
private
def
assert_html_output
(
to_test
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment