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
5b3cdef1
Commit
5b3cdef1
authored
May 16, 2019
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve vulnerability API
parent
21c17c0f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
8 deletions
+13
-8
ee/changelogs/unreleased/vulnerability-api-improvement.yml
ee/changelogs/unreleased/vulnerability-api-improvement.yml
+5
-0
ee/lib/api/vulnerabilities.rb
ee/lib/api/vulnerabilities.rb
+2
-4
ee/spec/requests/api/vulnerabilities_spec.rb
ee/spec/requests/api/vulnerabilities_spec.rb
+6
-4
No files found.
ee/changelogs/unreleased/vulnerability-api-improvement.yml
0 → 100644
View file @
5b3cdef1
---
title
:
Improve vulnerability API
merge_request
:
12760
author
:
Robert Schilling
type
:
other
ee/lib/api/vulnerabilities.rb
View file @
5b3cdef1
...
...
@@ -43,12 +43,10 @@ module API
end
get
':id/vulnerabilities'
do
project
=
Project
.
find
(
params
[
:id
])
not_found!
(
'Project'
)
unless
project
&&
can?
(
current_user
,
:read_project_security_dashboard
,
project
)
authorize!
:read_project_security_dashboard
,
user_project
vulnerability_occurrences
=
Kaminari
.
paginate_array
(
vulnerability_occurrences_by
(
declared_params
.
merge
(
project:
project
))
vulnerability_occurrences_by
(
declared_params
.
merge
(
project:
user_
project
))
)
present
paginate
(
vulnerability_occurrences
),
...
...
ee/spec/requests/api/vulnerabilities_spec.rb
View file @
5b3cdef1
...
...
@@ -114,16 +114,18 @@ describe API::Vulnerabilities do
stub_licensed_features
(
security_dashboard:
false
,
sast:
true
,
dependency_scanning:
true
,
container_scanning:
true
)
end
it
'responds with 40
4 Not Found
'
do
it
'responds with 40
3 Forbidden
'
do
get
api
(
"/projects/
#{
project
.
id
}
/vulnerabilities"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
40
4
)
expect
(
response
).
to
have_gitlab_http_status
(
40
3
)
end
end
context
'with
unauthorized user
'
do
context
'with
no project access
'
do
it
'responds with 404 Not Found'
do
get
api
(
"/projects/
#{
project
.
id
}
/vulnerabilities"
,
user
)
private_project
=
create
(
:project
)
get
api
(
"/projects/
#{
private_project
.
id
}
/vulnerabilities"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
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