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
3ca91553
Commit
3ca91553
authored
Feb 10, 2020
by
Michał Zając
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Load EE factories when seeding Vulnerabilities
parent
42a4f238
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
ee/db/fixtures/development/20_vulnerabilities.rb
ee/db/fixtures/development/20_vulnerabilities.rb
+5
-1
ee/spec/factories/vulnerabilities/occurrences.rb
ee/spec/factories/vulnerabilities/occurrences.rb
+1
-1
ee/spec/factories/vulnerabilities/scanners.rb
ee/spec/factories/vulnerabilities/scanners.rb
+5
-1
No files found.
ee/db/fixtures/development/20_vulnerabilities.rb
View file @
3ca91553
...
@@ -5,6 +5,8 @@ class Gitlab::Seeder::Vulnerabilities
...
@@ -5,6 +5,8 @@ class Gitlab::Seeder::Vulnerabilities
def
initialize
(
project
)
def
initialize
(
project
)
@project
=
project
@project
=
project
FactoryBot
.
definition_file_paths
<<
Rails
.
root
.
join
(
'ee'
,
'spec'
,
'factories'
)
FactoryBot
.
reload
# rubocop:disable Cop/ActiveRecordAssociationReload
end
end
def
seed!
def
seed!
...
@@ -63,10 +65,12 @@ class Gitlab::Seeder::Vulnerabilities
...
@@ -63,10 +65,12 @@ class Gitlab::Seeder::Vulnerabilities
end
end
def
create_occurrence
(
vulnerability
,
rank
,
primary_identifier
)
def
create_occurrence
(
vulnerability
,
rank
,
primary_identifier
)
scanner
=
FactoryBot
.
create
(
:vulnerabilities_scanner
,
project:
vulnerability
.
project
)
FactoryBot
.
create
(
FactoryBot
.
create
(
:vulnerabilities_occurrence
,
:vulnerabilities_occurrence
,
project:
project
,
project:
project
,
vulnerability:
vulnerability
,
vulnerability:
vulnerability
,
scanner:
scanner
,
severity:
random_severity_level
,
severity:
random_severity_level
,
confidence:
random_confidence_level
,
confidence:
random_confidence_level
,
primary_identifier:
primary_identifier
,
primary_identifier:
primary_identifier
,
...
@@ -78,7 +82,7 @@ class Gitlab::Seeder::Vulnerabilities
...
@@ -78,7 +82,7 @@ class Gitlab::Seeder::Vulnerabilities
def
create_identifier
(
rank
)
def
create_identifier
(
rank
)
FactoryBot
.
create
(
FactoryBot
.
create
(
:vulnerabilit
y
_identifier
,
:vulnerabilit
ies
_identifier
,
external_type:
"SECURITY_ID"
,
external_type:
"SECURITY_ID"
,
external_id:
"SECURITY_
#{
rank
}
"
,
external_id:
"SECURITY_
#{
rank
}
"
,
fingerprint:
random_fingerprint
,
fingerprint:
random_fingerprint
,
...
...
ee/spec/factories/vulnerabilities/occurrences.rb
View file @
3ca91553
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
FactoryBot
.
define
do
FactoryBot
.
define
do
sequence
:vulnerability_occurrence_uuid
do
|
n
|
sequence
:vulnerability_occurrence_uuid
do
|
n
|
Digest
::
SHA1
.
hexdigest
(
"uuid-
#{
n
}
"
)[
0
..
35
]
SecureRandom
.
uuid
end
end
factory
:vulnerabilities_occurrence
,
class:
'Vulnerabilities::Occurrence'
,
aliases:
[
:vulnerabilities_finding
]
do
factory
:vulnerabilities_occurrence
,
class:
'Vulnerabilities::Occurrence'
,
aliases:
[
:vulnerabilities_finding
]
do
...
...
ee/spec/factories/vulnerabilities/scanners.rb
View file @
3ca91553
# frozen_string_literal: true
# frozen_string_literal: true
FactoryBot
.
define
do
FactoryBot
.
define
do
sequence
(
:vulnerability_scanner_external_id
)
do
|
n
|
"find_sec_bugs #
#{
n
}
"
end
factory
:vulnerabilities_scanner
,
class:
'Vulnerabilities::Scanner'
do
factory
:vulnerabilities_scanner
,
class:
'Vulnerabilities::Scanner'
do
external_id
{
'find_sec_bugs'
}
sequence
(
:external_id
)
{
generate
(
:vulnerability_scanner_external_id
)
}
name
{
'Find Security Bugs'
}
name
{
'Find Security Bugs'
}
project
project
end
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