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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
c899cd3c
Commit
c899cd3c
authored
May 17, 2019
by
Patrick Derichs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix confidential issue label disclosure on milestone view
parent
d748f2a6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
1 deletion
+46
-1
app/controllers/concerns/milestone_actions.rb
app/controllers/concerns/milestone_actions.rb
+7
-1
changelogs/unreleased/security-fix-confidential-issue-label-visibility-master.yml
...curity-fix-confidential-issue-label-visibility-master.yml
+5
-0
spec/controllers/projects/milestones_controller_spec.rb
spec/controllers/projects/milestones_controller_spec.rb
+34
-0
No files found.
app/controllers/concerns/milestone_actions.rb
View file @
c899cd3c
...
@@ -26,16 +26,22 @@ module MilestoneActions
...
@@ -26,16 +26,22 @@ module MilestoneActions
end
end
end
end
# rubocop:disable Gitlab/ModuleWithInstanceVariables
def
labels
def
labels
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
{
redirect_to
milestone_redirect_path
}
format
.
html
{
redirect_to
milestone_redirect_path
}
format
.
json
do
format
.
json
do
milestone_labels
=
@milestone
.
issue_labels_visible_by_user
(
current_user
)
render
json:
tabs_json
(
"shared/milestones/_labels_tab"
,
{
render
json:
tabs_json
(
"shared/milestones/_labels_tab"
,
{
labels:
@milestone
.
labels
.
map
{
|
label
|
label
.
present
(
issuable_subject:
@milestone
.
parent
)
}
# rubocop:disable Gitlab/ModuleWithInstanceVariables
labels:
milestone_labels
.
map
do
|
label
|
label
.
present
(
issuable_subject:
@milestone
.
parent
)
end
})
})
end
end
end
end
end
end
# rubocop:enable Gitlab/ModuleWithInstanceVariables
private
private
...
...
changelogs/unreleased/security-fix-confidential-issue-label-visibility-master.yml
0 → 100644
View file @
c899cd3c
---
title
:
Fix confidential issue label disclosure on milestone view
merge_request
:
author
:
type
:
security
spec/controllers/projects/milestones_controller_spec.rb
View file @
c899cd3c
...
@@ -175,6 +175,40 @@ describe Projects::MilestonesController do
...
@@ -175,6 +175,40 @@ describe Projects::MilestonesController do
end
end
end
end
describe
'#labels'
do
render_views
context
'as json'
do
let!
(
:guest
)
{
create
(
:user
,
username:
'guest1'
)
}
let!
(
:group
)
{
create
(
:group
,
:public
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
group:
group
)
}
let!
(
:label
)
{
create
(
:label
,
title:
'test_label_on_private_issue'
,
project:
project
)
}
let!
(
:confidential_issue
)
{
create
(
:labeled_issue
,
confidential:
true
,
project:
project
,
milestone:
milestone
,
labels:
[
label
])
}
it
'does not render labels of private issues if user has no access'
do
sign_in
(
guest
)
get
:labels
,
params:
{
namespace_id:
group
.
id
,
project_id:
project
.
id
,
id:
milestone
.
iid
},
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
.
content_type
).
to
eq
'application/json'
expect
(
json_response
[
'html'
]).
not_to
include
(
label
.
title
)
end
it
'does render labels of private issues if user has access'
do
sign_in
(
user
)
get
:labels
,
params:
{
namespace_id:
group
.
id
,
project_id:
project
.
id
,
id:
milestone
.
iid
},
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
.
content_type
).
to
eq
'application/json'
expect
(
json_response
[
'html'
]).
to
include
(
label
.
title
)
end
end
end
context
'promotion succeeds'
do
context
'promotion succeeds'
do
before
do
before
do
group
.
add_developer
(
user
)
group
.
add_developer
(
user
)
...
...
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