BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
fec9fb05
Commit
fec9fb05
authored
Jan 18, 2018
by
Robert Speicher
Committed by
Robert Speicher
Feb 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'security-10-4-todo-api-reveals-sensitive-information' into 'security-10-4'
Restrict Todo API mark_as_done endpoint to the user's todos only
parent
603fa7c1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
2 deletions
+19
-2
security-10-4-todo-api-reveals-sensitive-information.yml
.../security-10-4-todo-api-reveals-sensitive-information.yml
+5
-0
todos.rb
lib/api/todos.rb
+1
-1
todos.rb
lib/api/v3/todos.rb
+1
-1
todos_spec.rb
spec/requests/api/todos_spec.rb
+6
-0
todos_spec.rb
spec/requests/api/v3/todos_spec.rb
+6
-0
No files found.
changelogs/unreleased/security-10-4-todo-api-reveals-sensitive-information.yml
0 → 100644
View file @
fec9fb05
---
title
:
Restrict Todo API mark_as_done endpoint to the user's todos only
merge_request
:
author
:
type
:
security
lib/api/todos.rb
View file @
fec9fb05
...
...
@@ -60,7 +60,7 @@ module API
end
post
':id/mark_as_done'
do
TodoService
.
new
.
mark_todos_as_done_by_ids
(
params
[
:id
],
current_user
)
todo
=
Todo
.
find
(
params
[
:id
])
todo
=
current_user
.
todos
.
find
(
params
[
:id
])
present
todo
,
with:
Entities
::
Todo
,
current_user:
current_user
end
...
...
lib/api/v3/todos.rb
View file @
fec9fb05
...
...
@@ -12,7 +12,7 @@ module API
end
delete
':id'
do
TodoService
.
new
.
mark_todos_as_done_by_ids
(
params
[
:id
],
current_user
)
todo
=
Todo
.
find
(
params
[
:id
])
todo
=
current_user
.
todos
.
find
(
params
[
:id
])
present
todo
,
with:
::
API
::
Entities
::
Todo
,
current_user:
current_user
end
...
...
spec/requests/api/todos_spec.rb
View file @
fec9fb05
...
...
@@ -129,6 +129,12 @@ describe API::Todos do
post
api
(
"/todos/
#{
pending_1
.
id
}
/mark_as_done"
,
john_doe
)
end
it
'returns 404 if the todo does not belong to the current user'
do
post
api
(
"/todos/
#{
pending_1
.
id
}
/mark_as_done"
,
author_1
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
end
...
...
spec/requests/api/v3/todos_spec.rb
View file @
fec9fb05
...
...
@@ -38,6 +38,12 @@ describe API::V3::Todos do
delete
v3_api
(
"/todos/
#{
pending_1
.
id
}
"
,
john_doe
)
end
it
'returns 404 if the todo does not belong to the current user'
do
delete
v3_api
(
"/todos/
#{
pending_1
.
id
}
"
,
author_1
)
expect
(
response
.
status
).
to
eq
(
404
)
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