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
06dcfe84
Commit
06dcfe84
authored
Sep 26, 2021
by
Saikat Sarkar
Committed by
Luke Duncalfe
Sep 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use to_h instead of to_hash for vulnerability_flag
parent
3f97c556
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
5 deletions
+5
-5
ee/app/models/vulnerabilities/flag.rb
ee/app/models/vulnerabilities/flag.rb
+1
-1
ee/app/services/security/store_report_service.rb
ee/app/services/security/store_report_service.rb
+1
-1
lib/gitlab/ci/reports/security/flag.rb
lib/gitlab/ci/reports/security/flag.rb
+1
-1
spec/lib/gitlab/ci/reports/security/flag_spec.rb
spec/lib/gitlab/ci/reports/security/flag_spec.rb
+2
-2
No files found.
ee/app/models/vulnerabilities/flag.rb
View file @
06dcfe84
...
@@ -15,7 +15,7 @@ module Vulnerabilities
...
@@ -15,7 +15,7 @@ module Vulnerabilities
}
}
def
initialize
(
attributes
)
def
initialize
(
attributes
)
attributes
=
attributes
.
to_h
ash
if
attributes
.
instance_of?
(
Gitlab
::
Ci
::
Reports
::
Security
::
Flag
)
attributes
=
attributes
.
to_h
if
attributes
.
respond_to?
(
:to_h
)
super
(
attributes
)
super
(
attributes
)
end
end
end
end
...
...
ee/app/services/security/store_report_service.rb
View file @
06dcfe84
...
@@ -269,7 +269,7 @@ module Security
...
@@ -269,7 +269,7 @@ module Security
vulnerability_finding_to_finding_map
.
each_slice
(
BATCH_SIZE
)
do
|
vf_to_findings
|
vulnerability_finding_to_finding_map
.
each_slice
(
BATCH_SIZE
)
do
|
vf_to_findings
|
records
=
vf_to_findings
.
flat_map
do
|
vulnerability_finding
,
finding
|
records
=
vf_to_findings
.
flat_map
do
|
vulnerability_finding
,
finding
|
finding
.
flags
.
map
{
|
flag
|
timestamps
.
merge
(
**
flag
.
to_h
ash
,
vulnerability_occurrence_id:
vulnerability_finding
.
id
)
}
finding
.
flags
.
map
{
|
flag
|
timestamps
.
merge
(
**
flag
.
to_h
,
vulnerability_occurrence_id:
vulnerability_finding
.
id
)
}
end
end
records
.
uniq!
records
.
uniq!
...
...
lib/gitlab/ci/reports/security/flag.rb
View file @
06dcfe84
...
@@ -20,7 +20,7 @@ module Gitlab
...
@@ -20,7 +20,7 @@ module Gitlab
@description
=
description
@description
=
description
end
end
def
to_h
ash
def
to_h
{
{
flag_type:
flag_type
,
flag_type:
flag_type
,
origin:
origin
,
origin:
origin
,
...
...
spec/lib/gitlab/ci/reports/security/flag_spec.rb
View file @
06dcfe84
...
@@ -18,9 +18,9 @@ RSpec.describe Gitlab::Ci::Reports::Security::Flag do
...
@@ -18,9 +18,9 @@ RSpec.describe Gitlab::Ci::Reports::Security::Flag do
end
end
end
end
describe
'#to_h
ash
'
do
describe
'#to_h'
do
it
'returns expected hash'
do
it
'returns expected hash'
do
expect
(
security_flag
.
to_h
ash
).
to
eq
(
expect
(
security_flag
.
to_h
).
to
eq
(
{
{
flag_type: :false_positive
,
flag_type: :false_positive
,
origin:
'post analyzer X'
,
origin:
'post analyzer X'
,
...
...
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