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
e6c70a58
Commit
e6c70a58
authored
Jun 22, 2020
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check access when sending TODOs related to merge requests
parent
3fb39b58
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
6 deletions
+39
-6
app/models/merge_request.rb
app/models/merge_request.rb
+1
-1
changelogs/unreleased/security-215175-filter-merge-participants.yml
.../unreleased/security-215175-filter-merge-participants.yml
+5
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+33
-5
No files found.
app/models/merge_request.rb
View file @
e6c70a58
...
@@ -518,7 +518,7 @@ class MergeRequest < ApplicationRecord
...
@@ -518,7 +518,7 @@ class MergeRequest < ApplicationRecord
participants
<<
merge_user
participants
<<
merge_user
end
end
participants
participants
.
select
{
|
participant
|
Ability
.
allowed?
(
participant
,
:read_merge_request
,
self
)
}
end
end
def
first_commit
def
first_commit
...
...
changelogs/unreleased/security-215175-filter-merge-participants.yml
0 → 100644
View file @
e6c70a58
---
title
:
Check access when sending TODOs related to merge requests
merge_request
:
author
:
type
:
security
spec/models/merge_request_spec.rb
View file @
e6c70a58
...
@@ -3661,7 +3661,7 @@ describe MergeRequest do
...
@@ -3661,7 +3661,7 @@ describe MergeRequest do
describe
'#merge_participants'
do
describe
'#merge_participants'
do
it
'contains author'
do
it
'contains author'
do
expect
(
subject
.
merge_participants
).
to
eq
([
subject
.
author
]
)
expect
(
subject
.
merge_participants
).
to
contain_exactly
(
subject
.
author
)
end
end
describe
'when merge_when_pipeline_succeeds? is true'
do
describe
'when merge_when_pipeline_succeeds? is true'
do
...
@@ -3675,8 +3675,20 @@ describe MergeRequest do
...
@@ -3675,8 +3675,20 @@ describe MergeRequest do
author:
user
)
author:
user
)
end
end
it
'contains author only'
do
context
'author is not a project member'
do
expect
(
subject
.
merge_participants
).
to
eq
([
subject
.
author
])
it
'is empty'
do
expect
(
subject
.
merge_participants
).
to
be_empty
end
end
context
'author is a project member'
do
before
do
subject
.
project
.
team
.
add_reporter
(
user
)
end
it
'contains author only'
do
expect
(
subject
.
merge_participants
).
to
contain_exactly
(
subject
.
author
)
end
end
end
end
end
...
@@ -3689,8 +3701,24 @@ describe MergeRequest do
...
@@ -3689,8 +3701,24 @@ describe MergeRequest do
merge_user:
merge_user
)
merge_user:
merge_user
)
end
end
it
'contains author and merge user'
do
before
do
expect
(
subject
.
merge_participants
).
to
eq
([
subject
.
author
,
merge_user
])
subject
.
project
.
team
.
add_reporter
(
subject
.
author
)
end
context
'merge user is not a member'
do
it
'contains author only'
do
expect
(
subject
.
merge_participants
).
to
contain_exactly
(
subject
.
author
)
end
end
context
'both author and merge users are project members'
do
before
do
subject
.
project
.
team
.
add_reporter
(
merge_user
)
end
it
'contains author and merge user'
do
expect
(
subject
.
merge_participants
).
to
contain_exactly
(
subject
.
author
,
merge_user
)
end
end
end
end
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