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
5ce41ac9
Commit
5ce41ac9
authored
Jan 21, 2021
by
jerasmus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sanitize target branch
Sanitized the target branch to prevent XSS
parent
bb68df56
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletion
+19
-1
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline_container.vue
...equest_widget/components/mr_widget_pipeline_container.vue
+2
-1
changelogs/unreleased/security-sanitize-target-branch.yml
changelogs/unreleased/security-sanitize-target-branch.yml
+5
-0
spec/frontend/vue_mr_widget/components/mr_widget_pipeline_container_spec.js
...mr_widget/components/mr_widget_pipeline_container_spec.js
+12
-0
No files found.
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline_container.vue
View file @
5ce41ac9
<
script
>
import
{
isNumber
}
from
'
lodash
'
;
import
{
sanitize
}
from
'
~/lib/dompurify
'
;
import
ArtifactsApp
from
'
./artifacts_list_app.vue
'
;
import
MrWidgetContainer
from
'
./mr_widget_container.vue
'
;
import
MrWidgetPipeline
from
'
./mr_widget_pipeline.vue
'
;
...
...
@@ -40,7 +41,7 @@ export default {
return
this
.
isPostMerge
?
this
.
mr
.
targetBranch
:
this
.
mr
.
sourceBranch
;
},
branchLink
()
{
return
this
.
isPostMerge
?
this
.
mr
.
targetBranch
:
this
.
mr
.
sourceBranchLink
;
return
this
.
isPostMerge
?
sanitize
(
this
.
mr
.
targetBranch
)
:
this
.
mr
.
sourceBranchLink
;
},
deployments
()
{
return
this
.
isPostMerge
?
this
.
mr
.
postMergeDeployments
:
this
.
mr
.
deployments
;
...
...
changelogs/unreleased/security-sanitize-target-branch.yml
0 → 100644
View file @
5ce41ac9
---
title
:
Sanitize target branch on MR page
merge_request
:
author
:
type
:
security
spec/frontend/vue_mr_widget/components/mr_widget_pipeline_container_spec.js
View file @
5ce41ac9
...
...
@@ -78,6 +78,18 @@ describe('MrWidgetPipelineContainer', () => {
});
});
it
(
'
sanitizes the targetBranch
'
,
()
=>
{
factory
({
isPostMerge
:
true
,
mr
:
{
...
mockStore
,
targetBranch
:
'
Foo<script>alert("XSS")</script>
'
,
},
});
expect
(
wrapper
.
find
(
MrWidgetPipeline
).
props
().
sourceBranchLink
).
toBe
(
'
Foo
'
);
});
it
(
'
renders deployments
'
,
()
=>
{
const
expectedProps
=
mockStore
.
postMergeDeployments
.
map
((
dep
)
=>
expect
.
objectContaining
({
...
...
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