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
Boxiang Sun
gitlab-ce
Commits
c11f7544
Commit
c11f7544
authored
Jul 10, 2019
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not show moved issue ids for user not authorized
Do not show moved issue id for users that cannot read issue
parent
b85e6215
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
1 deletion
+44
-1
app/serializers/issue_entity.rb
app/serializers/issue_entity.rb
+6
-1
changelogs/unreleased/security-hide_moved_issue_id.yml
changelogs/unreleased/security-hide_moved_issue_id.yml
+5
-0
spec/serializers/issue_entity_spec.rb
spec/serializers/issue_entity_spec.rb
+33
-0
No files found.
app/serializers/issue_entity.rb
View file @
c11f7544
...
...
@@ -16,9 +16,14 @@ class IssueEntity < IssuableEntity
expose
:discussion_locked
expose
:assignees
,
using:
API
::
Entities
::
UserBasic
expose
:due_date
expose
:moved_to_id
expose
:project_id
expose
:moved_to_id
do
|
issue
|
if
issue
.
moved_to_id
.
present?
&&
can?
(
request
.
current_user
,
:read_issue
,
issue
.
moved_to
)
issue
.
moved_to_id
end
end
expose
:web_url
do
|
issue
|
project_issue_path
(
issue
.
project
,
issue
)
end
...
...
changelogs/unreleased/security-hide_moved_issue_id.yml
0 → 100644
View file @
c11f7544
---
title
:
Do not show moved issue id for users that cannot read issue
merge_request
:
author
:
type
:
security
spec/serializers/issue_entity_spec.rb
View file @
c11f7544
...
...
@@ -17,4 +17,37 @@ describe IssueEntity do
it
'has time estimation attributes'
do
expect
(
subject
).
to
include
(
:time_estimate
,
:total_time_spent
,
:human_time_estimate
,
:human_total_time_spent
)
end
context
'when issue got moved'
do
let
(
:public_project
)
{
create
(
:project
,
:public
)
}
let
(
:member
)
{
create
(
:user
)
}
let
(
:non_member
)
{
create
(
:user
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
public_project
)
}
before
do
project
.
add_developer
(
member
)
public_project
.
add_developer
(
member
)
Issues
::
MoveService
.
new
(
public_project
,
member
).
execute
(
issue
,
project
)
end
context
'when user cannot read target project'
do
it
'does not return moved_to_id'
do
request
=
double
(
'request'
,
current_user:
non_member
)
response
=
described_class
.
new
(
issue
,
request:
request
).
as_json
expect
(
response
[
:moved_to_id
]).
to
be_nil
end
end
context
'when user can read target project'
do
it
'returns moved moved_to_id'
do
request
=
double
(
'request'
,
current_user:
member
)
response
=
described_class
.
new
(
issue
,
request:
request
).
as_json
expect
(
response
[
:moved_to_id
]).
to
eq
(
issue
.
moved_to_id
)
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