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
27db17fd
Commit
27db17fd
authored
Jun 25, 2020
by
Alan (Maciej) Paruszewski
Committed by
Jan Provaznik
Jun 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Vendor to Vulnerability Scanners
parent
9d3ebcaf
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
56 additions
and
1 deletion
+56
-1
db/migrate/20200622070606_add_vendor_to_vulnerability_scanners.rb
...te/20200622070606_add_vendor_to_vulnerability_scanners.rb
+23
-0
db/migrate/20200622070620_add_limit_to_vulnerability_scanners_vendor.rb
...00622070620_add_limit_to_vulnerability_scanners_vendor.rb
+17
-0
db/structure.sql
db/structure.sql
+7
-1
ee/app/models/vulnerabilities/scanner.rb
ee/app/models/vulnerabilities/scanner.rb
+1
-0
ee/changelogs/unreleased/210327-add-scanner-vendor-field.yml
ee/changelogs/unreleased/210327-add-scanner-vendor-field.yml
+5
-0
ee/spec/factories/vulnerabilities/scanners.rb
ee/spec/factories/vulnerabilities/scanners.rb
+1
-0
ee/spec/models/vulnerabilities/scanner_spec.rb
ee/spec/models/vulnerabilities/scanner_spec.rb
+2
-0
No files found.
db/migrate/20200622070606_add_vendor_to_vulnerability_scanners.rb
0 → 100644
View file @
27db17fd
# frozen_string_literal: true
class
AddVendorToVulnerabilityScanners
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
DEFAULT_SCANNER_VENDOR
=
'GitLab'
# rubocop:disable Migration/AddLimitToTextColumns
# limit is added in 20200622070620_add_limit_to_vulnerability_scanners_vendor
def
up
with_lock_retries
do
add_column
:vulnerability_scanners
,
:vendor
,
:text
,
default:
DEFAULT_SCANNER_VENDOR
,
null:
false
end
end
def
down
with_lock_retries
do
remove_column
:vulnerability_scanners
,
:vendor
end
end
# rubocop:enable Migration/AddLimitToTextColumns
end
db/migrate/20200622070620_add_limit_to_vulnerability_scanners_vendor.rb
0 → 100644
View file @
27db17fd
# frozen_string_literal: true
class
AddLimitToVulnerabilityScannersVendor
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_text_limit
:vulnerability_scanners
,
:vendor
,
255
,
validate:
false
end
def
down
remove_text_limit
:vulnerability_scanners
,
:vendor
end
end
db/structure.sql
View file @
27db17fd
...
...
@@ -7306,7 +7306,8 @@ CREATE TABLE public.vulnerability_scanners (
updated_at
timestamp
with
time
zone
NOT
NULL
,
project_id
integer
NOT
NULL
,
external_id
character
varying
NOT
NULL
,
name
character
varying
NOT
NULL
name
character
varying
NOT
NULL
,
vendor
text
DEFAULT
'GitLab'
::
text
NOT
NULL
);
CREATE
SEQUENCE
public
.
vulnerability_scanners_id_seq
...
...
@@ -8296,6 +8297,9 @@ ALTER TABLE ONLY public.chat_teams
ALTER
TABLE
public
.
design_management_designs
ADD
CONSTRAINT
check_07155e2715
CHECK
((
char_length
((
filename
)::
text
)
<=
255
))
NOT
VALID
;
ALTER
TABLE
public
.
vulnerability_scanners
ADD
CONSTRAINT
check_37608c9db5
CHECK
((
char_length
(
vendor
)
<=
255
))
NOT
VALID
;
ALTER
TABLE
ONLY
public
.
ci_build_needs
ADD
CONSTRAINT
ci_build_needs_pkey
PRIMARY
KEY
(
id
);
...
...
@@ -14151,6 +14155,8 @@ COPY "schema_migrations" (version) FROM STDIN;
20200618134723
20200619154527
20200619154528
20200622070606
20200622070620
20200622095419
20200622103836
20200622235737
...
...
ee/app/models/vulnerabilities/scanner.rb
View file @
27db17fd
...
...
@@ -11,6 +11,7 @@ module Vulnerabilities
validates
:project
,
presence:
true
validates
:external_id
,
presence:
true
,
uniqueness:
{
scope: :project_id
}
validates
:name
,
presence:
true
validates
:vendor
,
presence:
true
,
length:
{
maximum:
255
}
scope
:with_external_id
,
->
(
external_ids
)
{
where
(
external_id:
external_ids
)
}
end
...
...
ee/changelogs/unreleased/210327-add-scanner-vendor-field.yml
0 → 100644
View file @
27db17fd
---
title
:
Add vendor to Vulnerability Scanners
merge_request
:
35004
author
:
type
:
added
ee/spec/factories/vulnerabilities/scanners.rb
View file @
27db17fd
...
...
@@ -8,6 +8,7 @@ FactoryBot.define do
factory
:vulnerabilities_scanner
,
class:
'Vulnerabilities::Scanner'
do
sequence
(
:external_id
)
{
generate
(
:vulnerability_scanner_external_id
)
}
name
{
'Find Security Bugs'
}
vendor
{
'Security Vendor'
}
project
end
end
ee/spec/models/vulnerabilities/scanner_spec.rb
View file @
27db17fd
...
...
@@ -15,6 +15,8 @@ RSpec.describe Vulnerabilities::Scanner do
it
{
is_expected
.
to
validate_presence_of
(
:project
)
}
it
{
is_expected
.
to
validate_presence_of
(
:external_id
)
}
it
{
is_expected
.
to
validate_uniqueness_of
(
:external_id
).
scoped_to
(
:project_id
)
}
it
{
is_expected
.
to
validate_presence_of
(
:vendor
)
}
it
{
is_expected
.
to
validate_length_of
(
:vendor
).
is_at_most
(
255
)
}
end
describe
'.with_external_id'
do
...
...
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