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
2baac9e0
Commit
2baac9e0
authored
Jul 21, 2020
by
Alan (Maciej) Paruszewski
Committed by
Mayra Cabrera
Jul 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exclude license scanner types from SecurityScannerType enum
parent
3625ab69
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
7 deletions
+29
-7
ee/app/models/concerns/ee/project_security_scanners_information.rb
...dels/concerns/ee/project_security_scanners_information.rb
+2
-1
ee/changelogs/unreleased/fix_security_dashboard.yml
ee/changelogs/unreleased/fix_security_dashboard.yml
+5
-0
ee/spec/graphql/types/project_type_spec.rb
ee/spec/graphql/types/project_type_spec.rb
+5
-3
ee/spec/graphql/types/security_scanner_type_enum_spec.rb
ee/spec/graphql/types/security_scanner_type_enum_spec.rb
+9
-0
ee/spec/models/concerns/ee/project_security_scanners_information_spec.rb
...concerns/ee/project_security_scanners_information_spec.rb
+8
-3
No files found.
ee/app/models/concerns/ee/project_security_scanners_information.rb
View file @
2baac9e0
...
@@ -14,7 +14,8 @@ module EE
...
@@ -14,7 +14,8 @@ module EE
end
end
def
scanners_run_in_last_pipeline
def
scanners_run_in_last_pipeline
latest_builds_reports
(
only_successful_builds:
true
).
map
{
|
scanner
|
scanner
.
upcase
.
to_s
}.
compact
reports
=
latest_builds_reports
(
only_successful_builds:
true
)
all_security_scanners
.
map
{
|
scanner
|
scanner
.
upcase
.
to_s
if
reports
.
include?
(
scanner
)
}.
compact
end
end
private
private
...
...
ee/changelogs/unreleased/fix_security_dashboard.yml
0 → 100644
View file @
2baac9e0
---
title
:
Fix security dashboard by excluding license scanning information
merge_request
:
37318
author
:
type
:
fixed
ee/spec/graphql/types/project_type_spec.rb
View file @
2baac9e0
...
@@ -45,9 +45,11 @@ RSpec.describe GitlabSchema.types['Project'] do
...
@@ -45,9 +45,11 @@ RSpec.describe GitlabSchema.types['Project'] do
before
do
before
do
project
.
add_developer
(
user
)
project
.
add_developer
(
user
)
create
(
:ci_build
,
:sast
,
pipeline:
pipeline
,
status:
'success'
)
create
(
:ci_build
,
:success
,
:sast
,
pipeline:
pipeline
)
create
(
:ci_build
,
:dast
,
pipeline:
pipeline
,
status:
'success'
)
create
(
:ci_build
,
:success
,
:dast
,
pipeline:
pipeline
)
create
(
:ci_build
,
:secret_detection
,
pipeline:
pipeline
,
status:
'pending'
)
create
(
:ci_build
,
:success
,
:license_scanning
,
pipeline:
pipeline
)
create
(
:ci_build
,
:success
,
:license_management
,
pipeline:
pipeline
)
create
(
:ci_build
,
:pending
,
:secret_detection
,
pipeline:
pipeline
)
end
end
it
'returns a list of analyzers enabled for the project'
do
it
'returns a list of analyzers enabled for the project'
do
...
...
ee/spec/graphql/types/security_scanner_type_enum_spec.rb
0 → 100644
View file @
2baac9e0
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
GitlabSchema
.
types
[
'SecurityScannerType'
]
do
it
'exposes all security scanner types'
do
expect
(
described_class
.
values
.
keys
).
to
contain_exactly
(
*
%w[CONTAINER_SCANNING COVERAGE_FUZZING DAST DEPENDENCY_SCANNING SAST SECRET_DETECTION]
)
end
end
ee/spec/models/concerns/ee/project_security_scanners_information_spec.rb
View file @
2baac9e0
...
@@ -7,9 +7,10 @@ RSpec.describe ::EE::ProjectSecurityScannersInformation do
...
@@ -7,9 +7,10 @@ RSpec.describe ::EE::ProjectSecurityScannersInformation do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
,
ref:
project
.
default_branch
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
,
ref:
project
.
default_branch
)
}
before
do
before
do
create
(
:ci_build
,
:sast
,
pipeline:
pipeline
,
status:
'success'
)
create
(
:ci_build
,
:success
,
:sast
,
pipeline:
pipeline
)
create
(
:ci_build
,
:dast
,
pipeline:
pipeline
,
status:
'success'
)
create
(
:ci_build
,
:success
,
:dast
,
pipeline:
pipeline
)
create
(
:ci_build
,
:secret_detection
,
pipeline:
pipeline
,
status:
'pending'
)
create
(
:ci_build
,
:success
,
:license_scanning
,
pipeline:
pipeline
)
create
(
:ci_build
,
:pending
,
:secret_detection
,
pipeline:
pipeline
)
end
end
describe
'#available_scanners'
do
describe
'#available_scanners'
do
...
@@ -34,5 +35,9 @@ RSpec.describe ::EE::ProjectSecurityScannersInformation do
...
@@ -34,5 +35,9 @@ RSpec.describe ::EE::ProjectSecurityScannersInformation do
it
'returns a list of all scanners which were run successfully in the latest pipeline'
do
it
'returns a list of all scanners which were run successfully in the latest pipeline'
do
expect
(
project
.
scanners_run_in_last_pipeline
).
to
match_array
(
%w(DAST SAST)
)
expect
(
project
.
scanners_run_in_last_pipeline
).
to
match_array
(
%w(DAST SAST)
)
end
end
it
'does not include non-security scanners'
do
expect
(
project
.
scanners_run_in_last_pipeline
).
not_to
include
(
%w(LICENSE_SCANNING)
)
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