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
84aabb40
Commit
84aabb40
authored
Jul 16, 2020
by
Michał Zając
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename OccurrencePresenter to FindingPresenter
parent
c1a794aa
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
14 deletions
+15
-14
ee/app/presenters/vulnerabilities/finding_presenter.rb
ee/app/presenters/vulnerabilities/finding_presenter.rb
+2
-2
ee/app/services/security/merge_reports_service.rb
ee/app/services/security/merge_reports_service.rb
+1
-1
ee/lib/gitlab/ci/parsers/security/common.rb
ee/lib/gitlab/ci/parsers/security/common.rb
+1
-1
ee/spec/factories/ci/reports/security/reports.rb
ee/spec/factories/ci/reports/security/reports.rb
+1
-1
ee/spec/lib/gitlab/ci/reports/security/report_spec.rb
ee/spec/lib/gitlab/ci/reports/security/report_spec.rb
+5
-5
ee/spec/lib/gitlab/ci/reports/security/reports_spec.rb
ee/spec/lib/gitlab/ci/reports/security/reports_spec.rb
+4
-3
ee/spec/presenters/vulnerabilities/finding_presenter_spec.rb
ee/spec/presenters/vulnerabilities/finding_presenter_spec.rb
+1
-1
No files found.
ee/app/presenters/vulnerabilities/
occurrence
_presenter.rb
→
ee/app/presenters/vulnerabilities/
finding
_presenter.rb
View file @
84aabb40
# frozen_string_literal: true
module
Vulnerabilities
class
Occurrence
Presenter
<
Gitlab
::
View
::
Presenter
::
Delegated
presents
:
occurrence
class
Finding
Presenter
<
Gitlab
::
View
::
Presenter
::
Delegated
presents
:
finding
def
blob_path
return
''
unless
sha
.
present?
...
...
ee/app/services/security/merge_reports_service.rb
View file @
84aabb40
...
...
@@ -124,7 +124,7 @@ module Security
deduplicate_findings!
sort_findings!
@findings
.
each
{
|
finding
|
@target_report
.
finding
(
finding
)
}
@findings
.
each
{
|
finding
|
@target_report
.
add_
finding
(
finding
)
}
end
def
sort_by_ds_analyzers!
...
...
ee/lib/gitlab/ci/parsers/security/common.rb
View file @
84aabb40
...
...
@@ -54,7 +54,7 @@ module Gitlab
def
create_vulnerability
(
report
,
data
,
version
)
scanner
=
create_scanner
(
report
,
data
[
'scanner'
]
||
mutate_scanner_tool
(
data
[
'tool'
]))
identifiers
=
create_identifiers
(
report
,
data
[
'identifiers'
])
report
.
finding
(
report
.
add_
finding
(
::
Gitlab
::
Ci
::
Reports
::
Security
::
Occurrence
.
new
(
uuid:
SecureRandom
.
uuid
,
report_type:
report
.
type
,
...
...
ee/spec/factories/ci/reports/security/reports.rb
View file @
84aabb40
...
...
@@ -16,7 +16,7 @@ FactoryBot.define do
after
:build
do
|
report
,
evaluator
|
evaluator
.
scanners
.
each
{
|
s
|
report
.
add_scanner
(
s
)
}
evaluator
.
identifiers
.
each
{
|
id
|
report
.
add_identifier
(
id
)
}
evaluator
.
findings
.
each
{
|
o
|
report
.
finding
(
o
)
}
evaluator
.
findings
.
each
{
|
o
|
report
.
add_
finding
(
o
)
}
end
skip_create
...
...
ee/spec/lib/gitlab/ci/reports/security/report_spec.rb
View file @
84aabb40
...
...
@@ -45,7 +45,7 @@ RSpec.describe Gitlab::Ci::Reports::Security::Report do
let
(
:finding
)
{
create
(
:ci_reports_security_finding
)
}
it
'enriches given finding and stores it in the collection'
do
report
.
finding
(
finding
)
report
.
add_
finding
(
finding
)
expect
(
report
.
findings
).
to
eq
([
finding
])
end
...
...
@@ -131,7 +131,7 @@ RSpec.describe Gitlab::Ci::Reports::Security::Report do
let
(
:finding
)
{
build
(
:ci_reports_security_finding
,
severity:
severity
)
}
before
do
subject
.
finding
(
finding
)
subject
.
add_
finding
(
finding
)
end
it
{
expect
(
subject
.
unsafe_severity?
).
to
be
(
true
)
}
...
...
@@ -145,7 +145,7 @@ RSpec.describe Gitlab::Ci::Reports::Security::Report do
let
(
:finding
)
{
build
(
:ci_reports_security_finding
,
severity:
severity
)
}
before
do
subject
.
finding
(
finding
)
subject
.
add_
finding
(
finding
)
end
it
{
expect
(
subject
.
unsafe_severity?
).
to
be
(
false
)
}
...
...
@@ -157,7 +157,7 @@ RSpec.describe Gitlab::Ci::Reports::Security::Report do
let
(
:finding
)
{
build
(
:ci_reports_security_finding
,
severity:
nil
)
}
before
do
subject
.
finding
(
finding
)
subject
.
add_
finding
(
finding
)
end
it
{
expect
(
subject
.
unsafe_severity?
).
to
be
(
false
)
}
...
...
@@ -168,7 +168,7 @@ RSpec.describe Gitlab::Ci::Reports::Security::Report do
let
(
:finding
)
{
build
(
:ci_reports_security_finding
,
severity:
''
)
}
before
do
subject
.
finding
(
finding
)
subject
.
add_
finding
(
finding
)
end
it
{
expect
(
subject
.
unsafe_severity?
).
to
be
(
false
)
}
...
...
ee/spec/lib/gitlab/ci/reports/security/reports_spec.rb
View file @
84aabb40
...
...
@@ -46,8 +46,8 @@ RSpec.describe Gitlab::Ci::Reports::Security::Reports do
context
"when a report has a high severity vulnerability"
do
before
do
subject
.
get_report
(
'sast'
,
artifact
).
finding
(
high_severity
)
subject
.
get_report
(
'dependency_scanning'
,
artifact
).
finding
(
low_severity
)
subject
.
get_report
(
'sast'
,
artifact
).
add_
finding
(
high_severity
)
subject
.
get_report
(
'dependency_scanning'
,
artifact
).
add_
finding
(
low_severity
)
end
it
{
expect
(
subject
.
violates_default_policy?
).
to
be
(
true
)
}
...
...
@@ -56,7 +56,8 @@ RSpec.describe Gitlab::Ci::Reports::Security::Reports do
context
"when none of the reports have a high severity vulnerability"
do
before
do
subject
.
get_report
(
'sast'
,
artifact
).
finding
(
low_severity
)
subject
.
get_report
(
'dependency_scanning'
,
artifact
).
finding
(
low_severity
)
subject
.
get_report
(
'sast'
,
artifact
).
add_finding
(
low_severity
)
subject
.
get_report
(
'dependency_scanning'
,
artifact
).
add_finding
(
low_severity
)
end
it
{
expect
(
subject
.
violates_default_policy?
).
to
be
(
false
)
}
...
...
ee/spec/presenters/vulnerabilities/
occurrence
_presenter_spec.rb
→
ee/spec/presenters/vulnerabilities/
finding
_presenter_spec.rb
View file @
84aabb40
...
...
@@ -2,7 +2,7 @@
require
'spec_helper'
RSpec
.
describe
Vulnerabilities
::
Occurrence
Presenter
do
RSpec
.
describe
Vulnerabilities
::
Finding
Presenter
do
let
(
:presenter
)
{
described_class
.
new
(
occurrence
)
}
let
(
:occurrence
)
{
build_stubbed
(
:vulnerabilities_occurrence
)
}
...
...
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