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
8ed722bf
Commit
8ed722bf
authored
Jan 14, 2019
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid leaking unauthorized approver group members
parent
3f14d2f4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
1 deletion
+31
-1
ee/changelogs/unreleased/security-leaky-approver-group-members.yml
...logs/unreleased/security-leaky-approver-group-members.yml
+5
-0
ee/lib/ee/api/entities.rb
ee/lib/ee/api/entities.rb
+6
-0
ee/spec/controllers/projects/merge_requests_controller_spec.rb
...ec/controllers/projects/merge_requests_controller_spec.rb
+20
-1
No files found.
ee/changelogs/unreleased/security-leaky-approver-group-members.yml
0 → 100644
View file @
8ed722bf
---
title
:
Avoid leaking unauthorized approver group members
merge_request
:
766
author
:
type
:
security
ee/lib/ee/api/entities.rb
View file @
8ed722bf
...
...
@@ -231,6 +231,12 @@ module EE
end
class
MergeRequestApprovals
<
::
API
::
Entities
::
ProjectEntity
def
initialize
(
merge_request
,
options
=
{})
presenter
=
merge_request
.
present
(
current_user:
options
[
:current_user
])
super
(
presenter
,
options
)
end
expose
:merge_status
expose
:approvals_required
expose
:approvals_left
...
...
ee/spec/controllers/projects/merge_requests_controller_spec.rb
View file @
8ed722bf
...
...
@@ -41,7 +41,7 @@ shared_examples 'approvals' do
describe
'approvals'
do
let!
(
:approval
)
{
create
(
:approval
,
merge_request:
merge_request
,
user:
approver
.
user
)
}
before
do
def
get_approvals
get
:approvals
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
...
...
@@ -52,6 +52,8 @@ shared_examples 'approvals' do
end
it
'shows approval information'
do
get_approvals
approvals
=
json_response
expect
(
response
).
to
be_success
...
...
@@ -63,6 +65,23 @@ shared_examples 'approvals' do
expect
(
approvals
[
'suggested_approvers'
].
size
).
to
eq
1
expect
(
approvals
[
'suggested_approvers'
][
0
][
'username'
]).
to
eq
user
.
username
end
context
'with unauthorized group'
do
let
(
:private_group
)
{
create
(
:group_with_members
,
:private
)
}
before
do
create
(
:approver_group
,
target:
merge_request
,
group:
private_group
)
end
it
'does not expose approvers from a private group the current user has no access to'
do
get_approvals
approvals
=
json_response
expect
(
response
).
to
be_success
expect
(
approvals
[
'suggested_approvers'
].
size
).
to
eq
(
0
)
end
end
end
describe
'unapprove'
do
...
...
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