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
84905164
Commit
84905164
authored
May 17, 2021
by
Jonathan Schafer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename classes to singular to match current naming
Updated tests
parent
89040ac8
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
18 additions
and
18 deletions
+18
-18
ee/app/models/vulnerabilities/finding.rb
ee/app/models/vulnerabilities/finding.rb
+1
-1
ee/app/models/vulnerabilities/finding/evidence.rb
ee/app/models/vulnerabilities/finding/evidence.rb
+3
-3
ee/app/models/vulnerabilities/finding/evidence/request.rb
ee/app/models/vulnerabilities/finding/evidence/request.rb
+3
-3
ee/app/models/vulnerabilities/finding/evidence/response.rb
ee/app/models/vulnerabilities/finding/evidence/response.rb
+3
-3
ee/spec/models/vulnerabilities/finding/evidence/request_spec.rb
...c/models/vulnerabilities/finding/evidence/request_spec.rb
+2
-2
ee/spec/models/vulnerabilities/finding/evidence/response_spec.rb
.../models/vulnerabilities/finding/evidence/response_spec.rb
+2
-2
ee/spec/models/vulnerabilities/finding/evidence_spec.rb
ee/spec/models/vulnerabilities/finding/evidence_spec.rb
+3
-3
ee/spec/models/vulnerabilities/finding_spec.rb
ee/spec/models/vulnerabilities/finding_spec.rb
+1
-1
No files found.
ee/app/models/vulnerabilities/finding.rb
View file @
84905164
...
...
@@ -37,7 +37,7 @@ module Vulnerabilities
has_many
:signatures
,
class_name:
'Vulnerabilities::FindingSignature'
,
inverse_of: :finding
has_one
:evidence
,
class_name:
'Vulnerabilities::Finding
s
::Evidence'
,
inverse_of: :finding
,
foreign_key:
'vulnerability_occurrence_id'
has_one
:evidence
,
class_name:
'Vulnerabilities::Finding::Evidence'
,
inverse_of: :finding
,
foreign_key:
'vulnerability_occurrence_id'
serialize
:config_options
,
Serializers
::
JSON
# rubocop:disable Cop/ActiveRecordSerialize
...
...
ee/app/models/vulnerabilities/finding
s
/evidence.rb
→
ee/app/models/vulnerabilities/finding/evidence.rb
View file @
84905164
# frozen_string_literal: true
module
Vulnerabilities
class
Finding
s
class
Finding
class
Evidence
<
ApplicationRecord
self
.
table_name
=
'vulnerability_finding_evidences'
belongs_to
:finding
,
class_name:
'Vulnerabilities::Finding'
,
inverse_of: :evidence
,
foreign_key:
'vulnerability_occurrence_id'
,
optional:
false
has_one
:request
,
class_name:
'Vulnerabilities::Finding
s::Evidences
::Request'
,
inverse_of: :evidence
,
foreign_key:
'vulnerability_finding_evidence_id'
has_one
:response
,
class_name:
'Vulnerabilities::Finding
s::Evidences
::Response'
,
inverse_of: :evidence
,
foreign_key:
'vulnerability_finding_evidence_id'
has_one
:request
,
class_name:
'Vulnerabilities::Finding
::Evidence
::Request'
,
inverse_of: :evidence
,
foreign_key:
'vulnerability_finding_evidence_id'
has_one
:response
,
class_name:
'Vulnerabilities::Finding
::Evidence
::Response'
,
inverse_of: :evidence
,
foreign_key:
'vulnerability_finding_evidence_id'
validates
:summary
,
length:
{
maximum:
8_000_000
}
end
...
...
ee/app/models/vulnerabilities/finding
s/evidences
/request.rb
→
ee/app/models/vulnerabilities/finding
/evidence
/request.rb
View file @
84905164
# frozen_string_literal: true
module
Vulnerabilities
class
Finding
s
class
Evidence
s
class
Finding
class
Evidence
class
Request
<
ApplicationRecord
self
.
table_name
=
'vulnerability_finding_evidence_requests'
belongs_to
:evidence
,
class_name:
'Vulnerabilities::Finding
s
::Evidence'
,
inverse_of: :request
,
foreign_key:
'vulnerability_finding_evidence_id'
,
optional:
false
belongs_to
:evidence
,
class_name:
'Vulnerabilities::Finding::Evidence'
,
inverse_of: :request
,
foreign_key:
'vulnerability_finding_evidence_id'
,
optional:
false
validates
:method
,
length:
{
maximum:
32
}
validates
:url
,
length:
{
maximum:
2048
}
...
...
ee/app/models/vulnerabilities/finding
s/evidences
/response.rb
→
ee/app/models/vulnerabilities/finding
/evidence
/response.rb
View file @
84905164
# frozen_string_literal: true
module
Vulnerabilities
class
Finding
s
class
Evidence
s
class
Finding
class
Evidence
class
Response
<
ApplicationRecord
self
.
table_name
=
'vulnerability_finding_evidence_responses'
belongs_to
:evidence
,
class_name:
'Vulnerabilities::Finding
s
::Evidence'
,
inverse_of: :response
,
foreign_key:
'vulnerability_finding_evidence_id'
,
optional:
false
belongs_to
:evidence
,
class_name:
'Vulnerabilities::Finding::Evidence'
,
inverse_of: :response
,
foreign_key:
'vulnerability_finding_evidence_id'
,
optional:
false
validates
:reason_phrase
,
length:
{
maximum:
2048
}
validates
:body
,
length:
{
maximum:
2048
}
...
...
ee/spec/models/vulnerabilities/finding
s/evidences
/request_spec.rb
→
ee/spec/models/vulnerabilities/finding
/evidence
/request_spec.rb
View file @
84905164
...
...
@@ -2,8 +2,8 @@
require
'spec_helper'
RSpec
.
describe
Vulnerabilities
::
Finding
s
::
Evidences
::
Request
do
it
{
is_expected
.
to
belong_to
(
:evidence
).
class_name
(
'Vulnerabilities::Finding
s
::Evidence'
).
inverse_of
(
:request
).
required
}
RSpec
.
describe
Vulnerabilities
::
Finding
::
Evidence
::
Request
do
it
{
is_expected
.
to
belong_to
(
:evidence
).
class_name
(
'Vulnerabilities::Finding::Evidence'
).
inverse_of
(
:request
).
required
}
it
{
is_expected
.
to
validate_length_of
(
:method
).
is_at_most
(
32
)
}
it
{
is_expected
.
to
validate_length_of
(
:url
).
is_at_most
(
2048
)
}
...
...
ee/spec/models/vulnerabilities/finding
s/evidences
/response_spec.rb
→
ee/spec/models/vulnerabilities/finding
/evidence
/response_spec.rb
View file @
84905164
...
...
@@ -2,8 +2,8 @@
require
'spec_helper'
RSpec
.
describe
Vulnerabilities
::
Finding
s
::
Evidences
::
Response
do
it
{
is_expected
.
to
belong_to
(
:evidence
).
class_name
(
'Vulnerabilities::Finding
s
::Evidence'
).
inverse_of
(
:response
).
required
}
RSpec
.
describe
Vulnerabilities
::
Finding
::
Evidence
::
Response
do
it
{
is_expected
.
to
belong_to
(
:evidence
).
class_name
(
'Vulnerabilities::Finding::Evidence'
).
inverse_of
(
:response
).
required
}
it
{
is_expected
.
to
validate_length_of
(
:reason_phrase
).
is_at_most
(
2048
)
}
it
{
is_expected
.
to
validate_length_of
(
:body
).
is_at_most
(
2048
)
}
...
...
ee/spec/models/vulnerabilities/finding
s
/evidence_spec.rb
→
ee/spec/models/vulnerabilities/finding/evidence_spec.rb
View file @
84905164
...
...
@@ -2,10 +2,10 @@
require
'spec_helper'
RSpec
.
describe
Vulnerabilities
::
Finding
s
::
Evidence
do
RSpec
.
describe
Vulnerabilities
::
Finding
::
Evidence
do
it
{
is_expected
.
to
belong_to
(
:finding
).
class_name
(
'Vulnerabilities::Finding'
).
required
}
it
{
is_expected
.
to
have_one
(
:request
).
class_name
(
'Vulnerabilities::Finding
s::Evidences
::Request'
).
with_foreign_key
(
'vulnerability_finding_evidence_id'
).
inverse_of
(
:evidence
)
}
it
{
is_expected
.
to
have_one
(
:response
).
class_name
(
'Vulnerabilities::Finding
s::Evidences
::Response'
).
with_foreign_key
(
'vulnerability_finding_evidence_id'
).
inverse_of
(
:evidence
)
}
it
{
is_expected
.
to
have_one
(
:request
).
class_name
(
'Vulnerabilities::Finding
::Evidence
::Request'
).
with_foreign_key
(
'vulnerability_finding_evidence_id'
).
inverse_of
(
:evidence
)
}
it
{
is_expected
.
to
have_one
(
:response
).
class_name
(
'Vulnerabilities::Finding
::Evidence
::Response'
).
with_foreign_key
(
'vulnerability_finding_evidence_id'
).
inverse_of
(
:evidence
)
}
it
{
is_expected
.
to
validate_length_of
(
:summary
).
is_at_most
(
8_000_000
)
}
end
ee/spec/models/vulnerabilities/finding_spec.rb
View file @
84905164
...
...
@@ -26,7 +26,7 @@ RSpec.describe Vulnerabilities::Finding do
it
{
is_expected
.
to
have_many
(
:finding_links
).
class_name
(
'Vulnerabilities::FindingLink'
).
with_foreign_key
(
'vulnerability_occurrence_id'
)
}
it
{
is_expected
.
to
have_many
(
:finding_remediations
).
class_name
(
'Vulnerabilities::FindingRemediation'
).
with_foreign_key
(
'vulnerability_occurrence_id'
)
}
it
{
is_expected
.
to
have_many
(
:remediations
).
through
(
:finding_remediations
)
}
it
{
is_expected
.
to
have_one
(
:evidence
).
class_name
(
'Vulnerabilities::Finding
s
::Evidence'
).
with_foreign_key
(
'vulnerability_occurrence_id'
)
}
it
{
is_expected
.
to
have_one
(
:evidence
).
class_name
(
'Vulnerabilities::Finding::Evidence'
).
with_foreign_key
(
'vulnerability_occurrence_id'
)
}
end
describe
'validations'
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