Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OHR Support
Manage
Activity
Members
Labels
Plan
Issues
97
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
OHR Support
Commits
4e3fe484
Commit
4e3fe484
authored
13 years ago
by
Holger Just
Browse files
Options
Downloads
Patches
Plain Diff
[#647] Fix XSS in textile image syntax.
parent
4cea676d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/redcloth3.rb
+1
-1
1 addition, 1 deletion
lib/redcloth3.rb
test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
+9
-1
9 additions, 1 deletion
...nit/lib/redmine/wiki_formatting/textile_formatter_test.rb
with
10 additions
and
2 deletions
lib/redcloth3.rb
+
1
−
1
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);
...
...
This diff is collapsed.
Click to expand it.
test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
+
9
−
1
View file @
4e3fe484
...
...
@@ -85,7 +85,15 @@ class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase
'GPL(This is a double-quoted "title")'
=>
'<acronym title="This is a double-quoted "title"">GPL</acronym>'
)
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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment