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
7be39a89
Commit
7be39a89
authored
Mar 18, 2017
by
DJ Mountney
Committed by
DJ Mountney
Mar 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'render-json-leak' into 'security'
fix for render json include leaks See merge request !2074
parent
83a0c398
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
2 deletions
+38
-2
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-1
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+1
-1
spec/controllers/projects/issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+18
-0
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+18
-0
No files found.
app/controllers/projects/issues_controller.rb
View file @
7be39a89
...
@@ -146,7 +146,7 @@ class Projects::IssuesController < Projects::ApplicationController
...
@@ -146,7 +146,7 @@ class Projects::IssuesController < Projects::ApplicationController
end
end
format
.
json
do
format
.
json
do
render
json:
@issue
.
to_json
(
include:
{
milestone:
{},
assignee:
{
methods: :avatar_url
},
labels:
{
methods: :text_color
}
},
methods:
[
:task_status
,
:task_status_short
])
render
json:
@issue
.
to_json
(
include:
{
milestone:
{},
assignee:
{
only:
[
:name
,
:username
],
methods:
[
:avatar_url
]
},
labels:
{
methods: :text_color
}
},
methods:
[
:task_status
,
:task_status_short
])
end
end
end
end
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
7be39a89
...
@@ -308,7 +308,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -308,7 +308,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
end
format
.
json
do
format
.
json
do
render
json:
@merge_request
.
to_json
(
include:
{
milestone:
{},
assignee:
{
methods: :avatar_url
},
labels:
{
methods: :text_color
}
},
methods:
[
:task_status
,
:task_status_short
])
render
json:
@merge_request
.
to_json
(
include:
{
milestone:
{},
assignee:
{
only:
[
:name
,
:username
],
methods:
[
:avatar_url
]
},
labels:
{
methods: :text_color
}
},
methods:
[
:task_status
,
:task_status_short
])
end
end
end
end
rescue
ActiveRecord
::
StaleObjectError
rescue
ActiveRecord
::
StaleObjectError
...
...
spec/controllers/projects/issues_controller_spec.rb
View file @
7be39a89
...
@@ -141,6 +141,24 @@ describe Projects::IssuesController do
...
@@ -141,6 +141,24 @@ describe Projects::IssuesController do
it_behaves_like
'update invalid issuable'
,
Issue
it_behaves_like
'update invalid issuable'
,
Issue
context
'changing the assignee'
do
it
'limits the attributes exposed on the assignee'
do
assignee
=
create
(
:user
)
project
.
add_developer
(
assignee
)
put
:update
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
issue
.
iid
,
issue:
{
assignee_id:
assignee
.
id
},
format: :json
body
=
JSON
.
parse
(
response
.
body
)
expect
(
body
[
'assignee'
].
keys
)
.
to
match_array
(
%w(name username avatar_url)
)
end
end
context
'when moving issue to another private project'
do
context
'when moving issue to another private project'
do
let
(
:another_project
)
{
create
(
:empty_project
,
:private
)
}
let
(
:another_project
)
{
create
(
:empty_project
,
:private
)
}
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
7be39a89
...
@@ -203,6 +203,24 @@ describe Projects::MergeRequestsController do
...
@@ -203,6 +203,24 @@ describe Projects::MergeRequestsController do
end
end
describe
'PUT update'
do
describe
'PUT update'
do
context
'changing the assignee'
do
it
'limits the attributes exposed on the assignee'
do
assignee
=
create
(
:user
)
project
.
add_developer
(
assignee
)
put
:update
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
merge_request
.
iid
,
merge_request:
{
assignee_id:
assignee
.
id
},
format: :json
body
=
JSON
.
parse
(
response
.
body
)
expect
(
body
[
'assignee'
].
keys
)
.
to
match_array
(
%w(name username avatar_url)
)
end
end
context
'there is no source project'
do
context
'there is no source project'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:fork_project
)
{
create
(
:forked_project_with_submodules
)
}
let
(
:fork_project
)
{
create
(
:forked_project_with_submodules
)
}
...
...
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