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
2153dec3
Commit
2153dec3
authored
Aug 09, 2021
by
Mehmet Emin INAC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use sha_attribute to encode string values
parent
84a66d66
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
lib/gitlab/background_migration/recalculate_vulnerabilities_occurrences_uuid.rb
...migration/recalculate_vulnerabilities_occurrences_uuid.rb
+7
-6
No files found.
lib/gitlab/background_migration/recalculate_vulnerabilities_occurrences_uuid.rb
View file @
2153dec3
...
...
@@ -9,6 +9,8 @@ class Gitlab::BackgroundMigration::RecalculateVulnerabilitiesOccurrencesUuid
end
class
VulnerabilitiesFinding
<
ActiveRecord
::
Base
include
ShaAttribute
self
.
table_name
=
"vulnerability_occurrences"
belongs_to
:primary_identifier
,
class_name:
'VulnerabilitiesIdentifier'
,
inverse_of: :primary_findings
,
foreign_key:
'primary_identifier_id'
REPORT_TYPES
=
{
...
...
@@ -21,6 +23,9 @@ class Gitlab::BackgroundMigration::RecalculateVulnerabilitiesOccurrencesUuid
api_fuzzing:
6
}.
with_indifferent_access
.
freeze
enum
report_type:
REPORT_TYPES
sha_attribute
:fingerprint
sha_attribute
:location_fingerprint
end
class
CalculateFindingUUID
...
...
@@ -74,8 +79,8 @@ class Gitlab::BackgroundMigration::RecalculateVulnerabilitiesOccurrencesUuid
uuid_v5_name_components
=
{
report_type:
vulnerability_finding
.
report_type
,
primary_identifier_fingerprint:
encode_to_hex
(
vulnerability_finding
.
fingerprint
)
,
location_fingerprint:
encode_to_hex
(
vulnerability_finding
.
location_fingerprint
)
,
primary_identifier_fingerprint:
vulnerability_finding
.
fingerprint
,
location_fingerprint:
vulnerability_finding
.
location_fingerprint
,
project_id:
vulnerability_finding
.
project_id
}
...
...
@@ -84,10 +89,6 @@ class Gitlab::BackgroundMigration::RecalculateVulnerabilitiesOccurrencesUuid
CalculateFindingUUID
.
call
(
name
)
end
def
encode_to_hex
(
binary_string
)
Gitlab
::
Database
::
ShaAttribute
.
new
.
deserialize
(
binary_string
)
end
def
logger
@logger
||=
Gitlab
::
BackgroundMigration
::
Logger
.
build
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