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
9c102655
Commit
9c102655
authored
Nov 09, 2021
by
Mehmet Emin INAC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not propagate the security report parsing error to the clients
parent
ef6ded68
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
ee/lib/api/vulnerability_findings.rb
ee/lib/api/vulnerability_findings.rb
+5
-0
ee/spec/requests/api/vulnerability_findings_spec.rb
ee/spec/requests/api/vulnerability_findings_spec.rb
+14
-0
No files found.
ee/lib/api/vulnerability_findings.rb
View file @
9c102655
...
...
@@ -26,6 +26,9 @@ module API
end
end
# We are using this fallback to provide an early response to the users
# until the `security_findings` are stored.
# We will remove this fallback by https://gitlab.com/gitlab-org/gitlab/-/issues/334488
def
with_vulnerabilities_finder
aggregated_report
=
Security
::
PipelineVulnerabilitiesFinder
.
new
(
pipeline:
pipeline
,
params:
declared_params
).
execute
...
...
@@ -35,6 +38,8 @@ module API
# See https://gitlab.com/gitlab-org/gitlab/issues/33588#note_291849433
# for discussion
paginate
(
Kaminari
.
paginate_array
(
aggregated_report
.
findings
))
rescue
Security
::
PipelineVulnerabilitiesFinder
::
ParseError
paginate
(
Kaminari
.
paginate_array
([]))
end
def
with_adaptive_finder
...
...
ee/spec/requests/api/vulnerability_findings_spec.rb
View file @
9c102655
...
...
@@ -100,6 +100,20 @@ RSpec.describe API::VulnerabilityFindings do
expect
(
Security
::
PipelineVulnerabilitiesFinder
).
to
have_received
(
:new
)
end
context
'when the `Security::PipelineVulnerabilitiesFinder` raises exception'
do
before
do
allow_next_instance_of
(
Security
::
PipelineVulnerabilitiesFinder
)
do
|
finder
|
allow
(
finder
).
to
receive
(
:execute
).
and_raise
(
Security
::
PipelineVulnerabilitiesFinder
::
ParseError
.
new
(
'failed'
))
end
end
it
'does not propagate the error to the client'
do
get
api
(
project_vulnerability_findings_path
,
user
),
params:
pagination
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
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