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
09c1bdb8
Commit
09c1bdb8
authored
Dec 24, 2020
by
Rajat Jain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sanitize XSS in Epic milestone due date
Sanitize XSS in milestone title
parent
fd79577a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
2 deletions
+28
-2
ee/app/assets/javascripts/epic/utils/epic_utils.js
ee/app/assets/javascripts/epic/utils/epic_utils.js
+4
-2
ee/changelogs/unreleased/security-xss-epic-milestone.yml
ee/changelogs/unreleased/security-xss-epic-milestone.yml
+5
-0
ee/spec/frontend/epic/utils/epic_utils_spec.js
ee/spec/frontend/epic/utils/epic_utils_spec.js
+19
-0
No files found.
ee/app/assets/javascripts/epic/utils/epic_utils.js
View file @
09c1bdb8
...
...
@@ -6,6 +6,7 @@ import { __, s__, sprintf } from '~/locale';
import
createGqClient
,
{
fetchPolicies
}
from
'
~/lib/graphql
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
import
{
dateInWords
,
parsePikadayDate
}
from
'
~/lib/utils/datetime_utility
'
;
import
{
sanitize
}
from
'
~/lib/dompurify
'
;
import
{
dateTypes
}
from
'
../constants
'
;
...
...
@@ -54,8 +55,9 @@ const getDateFromMilestonesTooltip = ({
dueDateSourcingMilestoneDates
,
dueDateTimeFromMilestones
,
})
=>
{
const
dateSourcingMilestoneTitle
=
dateType
===
dateTypes
.
start
?
startDateSourcingMilestoneTitle
:
dueDateSourcingMilestoneTitle
;
const
dateSourcingMilestoneTitle
=
sanitize
(
dateType
===
dateTypes
.
start
?
startDateSourcingMilestoneTitle
:
dueDateSourcingMilestoneTitle
,
);
const
sourcingMilestoneDates
=
dateType
===
dateTypes
.
start
?
startDateSourcingMilestoneDates
:
dueDateSourcingMilestoneDates
;
...
...
ee/changelogs/unreleased/security-xss-epic-milestone.yml
0 → 100644
View file @
09c1bdb8
---
title
:
Sanitize XSS in Epic milestone due date
merge_request
:
author
:
type
:
security
ee/spec/frontend/epic/utils/epic_utils_spec.js
View file @
09c1bdb8
...
...
@@ -57,4 +57,23 @@ describe('epicUtils', () => {
expect
(
Cookies
.
get
(
'
collapsed_gutter
'
)).
toBe
(
`
${
collapsedGutterVal
}
`
);
// Cookie value will always be string
});
});
describe
(
'
getDateFromMilestonesTooltip
'
,
()
=>
{
it
(
'
Sanitizes html in milestone title
'
,
()
=>
{
const
tooltipText
=
epicUtils
.
getDateFromMilestonesTooltip
({
dateType
:
'
start
'
,
startDateSourcingMilestoneTitle
:
'
<svg width="100"><use xlink:href="/h5bp/html5-boilerplate/-/raw/master/demo.svg#x" /></svg>
'
,
startDateSourcingMilestoneDates
:
{
startDate
:
'
2020-12-23
'
,
dueDate
:
'
2021-01-28
'
,
},
startDateTimeFromMilestones
:
'
2020-12-22T18:30:00.000Z
'
,
dueDateTimeFromMilestones
:
'
2021-01-27T18:30:00.000Z
'
,
});
const
sanitizedTitle
=
'
<svg width="100"><use></use></svg>
'
;
expect
(
tooltipText
.
startsWith
(
sanitizedTitle
)).
toBe
(
true
);
});
});
});
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