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
dd199ff7
Commit
dd199ff7
authored
Apr 21, 2020
by
Michelle Gill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not return private project ID
parent
7ccd1d1b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
1 deletion
+45
-1
changelogs/unreleased/security-file-template-project.yml
changelogs/unreleased/security-file-template-project.yml
+5
-0
ee/lib/ee/api/entities/group.rb
ee/lib/ee/api/entities/group.rb
+5
-1
ee/spec/requests/api/groups_spec.rb
ee/spec/requests/api/groups_spec.rb
+35
-0
No files found.
changelogs/unreleased/security-file-template-project.yml
0 → 100644
View file @
dd199ff7
---
title
:
Do not return private project ID without permission
merge_request
:
author
:
type
:
security
ee/lib/ee/api/entities/group.rb
View file @
dd199ff7
...
...
@@ -14,7 +14,11 @@ module EE
expose
:checked_file_template_project_id
,
as: :file_template_project_id
,
if:
->
(
group
,
options
)
{
group
.
feature_available?
(
:custom_file_templates_for_namespace
)
}
if:
->
(
group
,
options
)
{
group
.
feature_available?
(
:custom_file_templates_for_namespace
)
&&
Ability
.
allowed?
(
options
[
:current_user
],
:read_project
,
group
.
checked_file_template_project
)
}
expose
:marked_for_deletion_on
,
if:
->
(
group
,
_
)
{
group
.
feature_available?
(
:adjourned_deletion_for_projects_and_groups
)
}
end
end
...
...
ee/spec/requests/api/groups_spec.rb
View file @
dd199ff7
...
...
@@ -106,6 +106,41 @@ describe API::Groups do
end
end
end
context
'file_template_project_id is a private project'
do
let_it_be
(
:private_project
)
{
create
(
:project
,
:private
,
group:
group
)
}
before
do
stub_licensed_features
(
custom_file_templates_for_namespace:
true
)
group
.
update_attribute
(
:file_template_project_id
,
private_project
.
id
)
end
context
'user has permission to private project'
do
it
'returns file_template_project_id'
do
private_project
.
add_maintainer
(
user
)
get
api
(
"/groups/
#{
group
.
id
}
"
,
user
)
expect
(
json_response
).
to
have_key
'file_template_project_id'
end
end
context
'user does not have permission to private project'
do
it
'does not return file_template_project_id'
do
get
api
(
"/groups/
#{
group
.
id
}
"
,
another_user
)
expect
(
json_response
).
not_to
have_key
'file_template_project_id'
end
end
context
'user is not logged in'
do
it
'does not return file_template_project_id'
do
get
api
(
"/groups/
#{
group
.
id
}
"
)
expect
(
json_response
).
not_to
have_key
'file_template_project_id'
end
end
end
end
describe
'PUT /groups/:id'
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