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
63f86810
Commit
63f86810
authored
Apr 21, 2020
by
Cameron Swords
Committed by
Dmytro Zaporozhets
Apr 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose vulnerability occurrence evidence
parent
e7e3fcef
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
2 deletions
+30
-2
ee/app/models/vulnerabilities/occurrence.rb
ee/app/models/vulnerabilities/occurrence.rb
+4
-0
ee/app/serializers/vulnerabilities/occurrence_entity.rb
ee/app/serializers/vulnerabilities/occurrence_entity.rb
+1
-0
ee/spec/factories/vulnerabilities/occurrences.rb
ee/spec/factories/vulnerabilities/occurrences.rb
+4
-1
ee/spec/models/vulnerabilities/occurrence_spec.rb
ee/spec/models/vulnerabilities/occurrence_spec.rb
+20
-0
ee/spec/serializers/vulnerabilities/occurrence_entity_spec.rb
...pec/serializers/vulnerabilities/occurrence_entity_spec.rb
+1
-1
No files found.
ee/app/models/vulnerabilities/occurrence.rb
View file @
63f86810
...
...
@@ -254,6 +254,10 @@ module Vulnerabilities
metadata
.
dig
(
'remediations'
)
end
def
evidence
metadata
.
dig
(
'evidence'
,
'summary'
)
end
alias_method
:==
,
:eql?
# eql? is necessary in some cases like array intersection
def
eql?
(
other
)
...
...
ee/app/serializers/vulnerabilities/occurrence_entity.rb
View file @
63f86810
...
...
@@ -29,6 +29,7 @@ class Vulnerabilities::OccurrenceEntity < Grape::Entity
expose
:location
expose
:remediations
expose
:solution
expose
:evidence
end
expose
:state
...
...
ee/spec/factories/vulnerabilities/occurrences.rb
View file @
63f86810
...
...
@@ -54,7 +54,10 @@ FactoryBot.define do
name:
"Cipher does not check for integrity first?"
,
url:
"https://crypto.stackexchange.com/questions/31428/pbewithmd5anddes-cipher-does-not-check-for-integrity-first"
}
]
],
evidence:
{
summary:
'Credit card detected'
}
}.
to_json
end
...
...
ee/spec/models/vulnerabilities/occurrence_spec.rb
View file @
63f86810
...
...
@@ -568,4 +568,24 @@ describe Vulnerabilities::Occurrence do
it
{
is_expected
.
to
eq
(
vulnerabilities_occurrence
.
remediations
.
dig
(
0
,
'summary'
))
}
end
end
describe
'#evidence'
do
it
'has an evidence summary when present'
do
occurrence
=
create
(
:vulnerabilities_occurrence
)
expect
(
occurrence
.
evidence
).
to
eq
(
occurrence
.
metadata
[
'evidence'
][
'summary'
])
end
it
'has no evidence summary when evidence is present, summary is not'
do
occurrence
=
create
(
:vulnerabilities_occurrence
,
raw_metadata:
{
evidence:
{}
})
expect
(
occurrence
.
evidence
).
to
be_nil
end
it
'has no evidence summary when evidence is not present'
do
occurrence
=
create
(
:vulnerabilities_occurrence
,
raw_metadata:
{})
expect
(
occurrence
.
evidence
).
to
be_nil
end
end
end
ee/spec/serializers/vulnerabilities/occurrence_entity_spec.rb
View file @
63f86810
...
...
@@ -54,7 +54,7 @@ describe Vulnerabilities::OccurrenceEntity do
expect
(
subject
).
to
include
(
:name
,
:report_type
,
:severity
,
:confidence
,
:project_fingerprint
)
expect
(
subject
).
to
include
(
:scanner
,
:project
,
:identifiers
)
expect
(
subject
).
to
include
(
:dismissal_feedback
,
:issue_feedback
)
expect
(
subject
).
to
include
(
:description
,
:links
,
:location
,
:remediations
,
:solution
)
expect
(
subject
).
to
include
(
:description
,
:links
,
:location
,
:remediations
,
:solution
,
:evidence
)
expect
(
subject
).
to
include
(
:blob_path
)
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