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
58420132
Commit
58420132
authored
Jul 22, 2020
by
Michał Zając
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename occurrence_key to finding_key
parent
96278cf9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
12 deletions
+12
-12
ee/app/models/vulnerabilities/feedback.rb
ee/app/models/vulnerabilities/feedback.rb
+1
-1
ee/app/models/vulnerabilities/finding.rb
ee/app/models/vulnerabilities/finding.rb
+8
-8
ee/spec/lib/gitlab/ci/reports/security/report_spec.rb
ee/spec/lib/gitlab/ci/reports/security/report_spec.rb
+2
-2
ee/spec/models/vulnerabilities/feedback_spec.rb
ee/spec/models/vulnerabilities/feedback_spec.rb
+1
-1
No files found.
ee/app/models/vulnerabilities/feedback.rb
View file @
58420132
...
...
@@ -76,7 +76,7 @@ module Vulnerabilities
comment
.
present?
&&
comment_author
.
present?
end
def
occurrence
_key
def
finding
_key
{
project_id:
project_id
,
category:
category
,
...
...
ee/app/models/vulnerabilities/finding.rb
View file @
58420132
...
...
@@ -194,10 +194,10 @@ module Vulnerabilities
end
def
load_feedback
BatchLoader
.
for
(
occurrence_key
).
batch
(
replace_methods:
false
)
do
|
occurrence
_keys
,
loader
|
project_ids
=
occurrence
_keys
.
map
{
|
key
|
key
[
:project_id
]
}
categories
=
occurrence
_keys
.
map
{
|
key
|
key
[
:category
]
}
fingerprints
=
occurrence
_keys
.
map
{
|
key
|
key
[
:project_fingerprint
]
}
BatchLoader
.
for
(
finding_key
).
batch
(
replace_methods:
false
)
do
|
finding
_keys
,
loader
|
project_ids
=
finding
_keys
.
map
{
|
key
|
key
[
:project_id
]
}
categories
=
finding
_keys
.
map
{
|
key
|
key
[
:category
]
}
fingerprints
=
finding
_keys
.
map
{
|
key
|
key
[
:project_fingerprint
]
}
feedback
=
Vulnerabilities
::
Feedback
.
all_preloaded
.
where
(
project_id:
project_ids
.
uniq
,
...
...
@@ -205,10 +205,10 @@ module Vulnerabilities
project_fingerprint:
fingerprints
.
uniq
).
to_a
occurrence_keys
.
each
do
|
occurrence
_key
|
finding_keys
.
each
do
|
finding
_key
|
loader
.
call
(
occurrence
_key
,
feedback
.
select
{
|
f
|
occurrence_key
==
f
.
occurrence
_key
}
finding
_key
,
feedback
.
select
{
|
f
|
finding_key
==
f
.
finding
_key
}
)
end
end
...
...
@@ -311,7 +311,7 @@ module Vulnerabilities
private
def
occurrence
_key
def
finding
_key
{
project_id:
project_id
,
category:
report_type
,
...
...
ee/spec/lib/gitlab/ci/reports/security/report_spec.rb
View file @
58420132
...
...
@@ -157,7 +157,7 @@ RSpec.describe Gitlab::Ci::Reports::Security::Report do
let
(
:finding
)
{
build
(
:ci_reports_security_finding
,
severity:
nil
)
}
before
do
subject
.
add_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
.
add_finding
(
finding
)
subject
.
add_finding
(
finding
)
end
it
{
expect
(
subject
.
unsafe_severity?
).
to
be
(
false
)
}
...
...
ee/spec/models/vulnerabilities/feedback_spec.rb
View file @
58420132
...
...
@@ -228,7 +228,7 @@ RSpec.describe Vulnerabilities::Feedback do
let
(
:expected_occurrence_key
)
{
{
project_id:
project_id
,
category:
category
,
project_fingerprint:
project_fingerprint
}
}
let
(
:feedback
)
{
build
(
:vulnerability_feedback
,
expected_occurrence_key
)
}
subject
{
feedback
.
occurrence
_key
}
subject
{
feedback
.
finding
_key
}
it
{
is_expected
.
to
eq
(
expected_occurrence_key
)
}
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