Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
af20fe80
Commit
af20fe80
authored
Jul 10, 2020
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Escape milestone title in sidebar tooltip
Prevents XSS attack in issue and MR sidebars
parent
a6875e5f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
1 deletion
+14
-1
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+1
-1
changelogs/unreleased/security-fix-xss-in-milestone-tooltip.yml
...logs/unreleased/security-fix-xss-in-milestone-tooltip.yml
+5
-0
spec/helpers/issuables_helper_spec.rb
spec/helpers/issuables_helper_spec.rb
+8
-0
No files found.
app/helpers/issuables_helper.rb
View file @
af20fe80
...
...
@@ -29,7 +29,7 @@ module IssuablesHelper
def
sidebar_milestone_tooltip_label
(
milestone
)
return
_
(
'Milestone'
)
unless
milestone
.
present?
[
milestone
[
:title
]
,
sidebar_milestone_remaining_days
(
milestone
)
||
_
(
'Milestone'
)].
join
(
'<br/>'
)
[
escape_once
(
milestone
[
:title
])
,
sidebar_milestone_remaining_days
(
milestone
)
||
_
(
'Milestone'
)].
join
(
'<br/>'
)
end
def
sidebar_milestone_remaining_days
(
milestone
)
...
...
changelogs/unreleased/security-fix-xss-in-milestone-tooltip.yml
0 → 100644
View file @
af20fe80
---
title
:
Fix XSS in milestone tooltips
merge_request
:
author
:
type
:
security
spec/helpers/issuables_helper_spec.rb
View file @
af20fe80
...
...
@@ -327,4 +327,12 @@ RSpec.describe IssuablesHelper do
end
end
end
describe
'#sidebar_milestone_tooltip_label'
do
it
'escapes HTML in the milestone title'
do
milestone
=
build
(
:milestone
,
title:
'<img onerror=alert(1)>'
)
expect
(
helper
.
sidebar_milestone_tooltip_label
(
milestone
)).
to
eq
(
'<img onerror=alert(1)><br/>Milestone'
)
end
end
end
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