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
68d13322
Commit
68d13322
authored
Jan 09, 2019
by
Oswaldo Ferreira
Committed by
Yorick Peterse
Jan 31, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't process MR refs for guests in the notes
parent
a3cde026
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
+17
-2
app/policies/project_policy.rb
app/policies/project_policy.rb
+1
-1
changelogs/unreleased/security-do-not-process-mr-ref-for-guests.yml
.../unreleased/security-do-not-process-mr-ref-for-guests.yml
+5
-0
spec/policies/project_policy_spec.rb
spec/policies/project_policy_spec.rb
+11
-1
No files found.
app/policies/project_policy.rb
View file @
68d13322
...
@@ -393,7 +393,7 @@ class ProjectPolicy < BasePolicy
...
@@ -393,7 +393,7 @@ class ProjectPolicy < BasePolicy
end
.
enable
:read_issue_iid
end
.
enable
:read_issue_iid
rule
do
rule
do
(
can?
(
:read_project_for_iids
)
&
merge_requests_visible_to_user
)
|
can?
(
:read_merge_request
)
(
~
guest
&
can?
(
:read_project_for_iids
)
&
merge_requests_visible_to_user
)
|
can?
(
:read_merge_request
)
end
.
enable
:read_merge_request_iid
end
.
enable
:read_merge_request_iid
rule
{
~
can_have_multiple_clusters
&
has_clusters
}.
prevent
:add_cluster
rule
{
~
can_have_multiple_clusters
&
has_clusters
}.
prevent
:add_cluster
...
...
changelogs/unreleased/security-do-not-process-mr-ref-for-guests.yml
0 → 100644
View file @
68d13322
---
title
:
Don't process MR refs for guests in the notes
merge_request
:
2771
author
:
type
:
security
spec/policies/project_policy_spec.rb
View file @
68d13322
...
@@ -12,7 +12,7 @@ describe ProjectPolicy do
...
@@ -12,7 +12,7 @@ describe ProjectPolicy do
let
(
:base_guest_permissions
)
do
let
(
:base_guest_permissions
)
do
%i[
%i[
read_project read_board read_list read_wiki read_issue
read_project read_board read_list read_wiki read_issue
read_project_for_iids read_issue_iid read_
merge_request_iid read_
label
read_project_for_iids read_issue_iid read_label
read_milestone read_project_snippet read_project_member read_note
read_milestone read_project_snippet read_project_member read_note
create_project create_issue create_note upload_file create_merge_request_in
create_project create_issue create_note upload_file create_merge_request_in
award_emoji read_release
award_emoji read_release
...
@@ -152,6 +152,16 @@ describe ProjectPolicy do
...
@@ -152,6 +152,16 @@ describe ProjectPolicy do
end
end
end
end
context
'for a guest in a private project'
do
let
(
:project
)
{
create
(
:project
,
:private
)
}
subject
{
described_class
.
new
(
guest
,
project
)
}
it
'disallows the guest from reading the merge request and merge request iid'
do
expect_disallowed
(
:read_merge_request
)
expect_disallowed
(
:read_merge_request_iid
)
end
end
context
'builds feature'
do
context
'builds feature'
do
subject
{
described_class
.
new
(
owner
,
project
)
}
subject
{
described_class
.
new
(
owner
,
project
)
}
...
...
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