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
94700914
Commit
94700914
authored
Feb 25, 2020
by
celdem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't parse undefined severity confidence from reports
parent
51813f5b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
5 deletions
+38
-5
changelogs/unreleased/do-not-parse-undefined-severity-confidence.yml
...unreleased/do-not-parse-undefined-severity-confidence.yml
+5
-0
ee/lib/gitlab/ci/parsers/security/common.rb
ee/lib/gitlab/ci/parsers/security/common.rb
+2
-1
ee/spec/finders/security/pipeline_vulnerabilities_finder_spec.rb
.../finders/security/pipeline_vulnerabilities_finder_spec.rb
+4
-4
ee/spec/lib/gitlab/ci/parsers/security/common_spec.rb
ee/spec/lib/gitlab/ci/parsers/security/common_spec.rb
+27
-0
No files found.
changelogs/unreleased/do-not-parse-undefined-severity-confidence.yml
0 → 100644
View file @
94700914
---
title
:
Do not parse undefined severity and confidence from reports
merge_request
:
25884
author
:
type
:
other
ee/lib/gitlab/ci/parsers/security/common.rb
View file @
94700914
...
...
@@ -93,7 +93,8 @@ module Gitlab
end
def
parse_level
(
input
)
input
.
blank?
?
'undefined'
:
input
.
downcase
input
=
input
&
.
downcase
input
.
blank?
||
input
==
'undefined'
?
'unknown'
:
input
end
def
create_location
(
location_data
)
...
...
ee/spec/finders/security/pipeline_vulnerabilities_finder_spec.rb
View file @
94700914
...
...
@@ -185,7 +185,7 @@ describe Security::PipelineVulnerabilitiesFinder do
subject
{
described_class
.
new
(
pipeline:
pipeline
).
execute
}
it
'returns all vulnerability severity levels'
do
expect
(
subject
.
occurrences
.
map
(
&
:severity
).
uniq
).
to
match_array
(
%w[un
defined un
known low medium high critical info]
)
expect
(
subject
.
occurrences
.
map
(
&
:severity
).
uniq
).
to
match_array
(
%w[unknown low medium high critical info]
)
end
end
...
...
@@ -203,7 +203,7 @@ describe Security::PipelineVulnerabilitiesFinder do
subject
{
described_class
.
new
(
pipeline:
pipeline
).
execute
}
it
'returns all vulnerability confidence levels'
do
expect
(
subject
.
occurrences
.
map
(
&
:confidence
).
uniq
).
to
match_array
%w[un
defined un
known low medium high]
expect
(
subject
.
occurrences
.
map
(
&
:confidence
).
uniq
).
to
match_array
%w[unknown low medium high]
end
end
...
...
@@ -222,8 +222,8 @@ describe Security::PipelineVulnerabilitiesFinder do
it
'filters by all params'
do
expect
(
subject
.
occurrences
.
count
).
to
eq
(
cs_count
+
dast_count
+
ds_count
+
sast_count
)
expect
(
subject
.
occurrences
.
map
(
&
:confidence
).
uniq
).
to
match_array
(
%w[un
defined un
known low medium high]
)
expect
(
subject
.
occurrences
.
map
(
&
:severity
).
uniq
).
to
match_array
(
%w[un
defined un
known low medium high critical info]
)
expect
(
subject
.
occurrences
.
map
(
&
:confidence
).
uniq
).
to
match_array
(
%w[unknown low medium high]
)
expect
(
subject
.
occurrences
.
map
(
&
:severity
).
uniq
).
to
match_array
(
%w[unknown low medium high critical info]
)
end
end
...
...
ee/spec/lib/gitlab/ci/parsers/security/common_spec.rb
0 → 100644
View file @
94700914
# frozen_string_literal: true
require
'spec_helper'
describe
Gitlab
::
Ci
::
Parsers
::
Security
::
Common
do
describe
'#parse!'
do
let
(
:artifact
)
{
create
(
:ee_ci_job_artifact
,
:dependency_scanning
)
}
let
(
:report
)
{
Gitlab
::
Ci
::
Reports
::
Security
::
Report
.
new
(
artifact
.
file_type
,
'sha'
,
2
.
weeks
.
ago
)
}
let
(
:parser
)
{
described_class
.
new
}
before
do
allow
(
parser
).
to
receive
(
:create_location
).
and_return
(
nil
)
artifact
.
each_blob
do
|
blob
|
blob
.
gsub!
(
"Unknown"
,
"Undefined"
)
parser
.
parse!
(
blob
,
report
)
end
end
it
"converts undefined severity and confidence"
do
expect
(
report
.
occurrences
.
map
(
&
:severity
)).
to
include
(
"unknown"
)
expect
(
report
.
occurrences
.
map
(
&
:confidence
)).
to
include
(
"unknown"
)
expect
(
report
.
occurrences
.
map
(
&
:severity
)).
not_to
include
(
"undefined"
)
expect
(
report
.
occurrences
.
map
(
&
:confidence
)).
not_to
include
(
"undefined"
)
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