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
7f0d713e
Commit
7f0d713e
authored
Jun 25, 2020
by
Craig Smith
Committed by
Dmytro Zaporozhets
Jun 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SecurityReportSummary is null if report didn't run
parent
2c122398
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
7 deletions
+14
-7
ee/app/services/security/report_summary_service.rb
ee/app/services/security/report_summary_service.rb
+6
-0
ee/changelogs/unreleased/hide_scans_that_have_not_run_223673.yml
...gelogs/unreleased/hide_scans_that_have_not_run_223673.yml
+5
-0
ee/spec/services/security/report_summary_service_spec.rb
ee/spec/services/security/report_summary_service_spec.rb
+3
-7
No files found.
ee/app/services/security/report_summary_service.rb
View file @
7f0d713e
...
@@ -20,6 +20,8 @@ module Security
...
@@ -20,6 +20,8 @@ module Security
private
private
def
summary_counts_for_report_type
(
report_type
,
summary_types
)
def
summary_counts_for_report_type
(
report_type
,
summary_types
)
return
unless
report_exists?
(
report_type
)
summary_types
.
each_with_object
({})
do
|
summary_type
,
response
|
summary_types
.
each_with_object
({})
do
|
summary_type
,
response
|
case
summary_type
case
summary_type
when
:vulnerabilities_count
when
:vulnerabilities_count
...
@@ -46,5 +48,9 @@ module Security
...
@@ -46,5 +48,9 @@ module Security
::
Security
::
ScannedResourcesCountingService
.
new
(
@pipeline
,
requested_report_types
(
:scanned_resources_count
)).
execute
::
Security
::
ScannedResourcesCountingService
.
new
(
@pipeline
,
requested_report_types
(
:scanned_resources_count
)).
execute
end
end
end
end
def
report_exists?
(
report_type
)
@pipeline
&
.
security_reports
&
.
reports
&
.
key?
(
report_type
.
to_s
)
end
end
end
end
end
ee/changelogs/unreleased/hide_scans_that_have_not_run_223673.yml
0 → 100644
View file @
7f0d713e
---
title
:
Return
null
in securityReportSummary when the report didn't run
merge_request
:
35218
author
:
type
:
changed
ee/spec/services/security/report_summary_service_spec.rb
View file @
7f0d713e
...
@@ -98,15 +98,11 @@ describe Security::ReportSummaryService, '#execute' do
...
@@ -98,15 +98,11 @@ describe Security::ReportSummaryService, '#execute' do
))
))
end
end
context
'When
ran no security scans
'
do
context
'When
no security scans ran
'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
:success
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
:success
)
}
it
'returns 0 vulnerabilities'
do
it
'returns nil'
do
expect
(
result
[
:dast
][
:vulnerabilities_count
]).
to
be
(
0
)
expect
(
result
[
:dast
]).
to
be_nil
end
it
'returns 0 scanned resources'
do
expect
(
result
[
:dast
][
:scanned_resources_count
]).
to
be
(
0
)
end
end
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