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
0a290327
Commit
0a290327
authored
Aug 05, 2021
by
Jonathan Schafer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change Evidence Supporting Messages to array
Changelog: changed EE: true
parent
f047a319
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
18 deletions
+100
-18
ee/app/models/vulnerabilities/finding/evidence.rb
ee/app/models/vulnerabilities/finding/evidence.rb
+25
-6
ee/app/models/vulnerabilities/finding/evidence/supporting_message.rb
...ls/vulnerabilities/finding/evidence/supporting_message.rb
+13
-3
ee/spec/models/vulnerabilities/finding/evidence/supporting_message_spec.rb
...lnerabilities/finding/evidence/supporting_message_spec.rb
+21
-3
ee/spec/models/vulnerabilities/finding/evidence_spec.rb
ee/spec/models/vulnerabilities/finding/evidence_spec.rb
+41
-6
No files found.
ee/app/models/vulnerabilities/finding/evidence.rb
View file @
0a290327
...
...
@@ -5,13 +5,32 @@ module Vulnerabilities
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
belongs_to
:finding
,
class_name:
'Vulnerabilities::Finding'
,
inverse_of: :evidence
,
foreign_key:
'vulnerability_occurrence_id'
,
optional:
false
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'
has_one
:supporting_message
,
class_name:
'Vulnerabilities::Finding::Evidence::SupportingMessage'
,
inverse_of: :evidence
,
foreign_key:
'vulnerability_finding_evidence_id'
has_one
:source
,
class_name:
'Vulnerabilities::Finding::Evidence::Source'
,
inverse_of: :evidence
,
foreign_key:
'vulnerability_finding_evidence_id'
has_many
:assets
,
class_name:
'Vulnerabilities::Finding::Evidence::Asset'
,
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'
has_one
:source
,
class_name:
'Vulnerabilities::Finding::Evidence::Source'
,
inverse_of: :evidence
,
foreign_key:
'vulnerability_finding_evidence_id'
has_many
:supporting_messages
,
class_name:
'Vulnerabilities::Finding::Evidence::SupportingMessage'
,
inverse_of: :evidence
,
foreign_key:
'vulnerability_finding_evidence_id'
has_many
:assets
,
class_name:
'Vulnerabilities::Finding::Evidence::Asset'
,
inverse_of: :evidence
,
foreign_key:
'vulnerability_finding_evidence_id'
validates
:summary
,
length:
{
maximum:
8_000_000
}
end
...
...
ee/app/models/vulnerabilities/finding/evidence/supporting_message.rb
View file @
0a290327
...
...
@@ -6,10 +6,20 @@ module Vulnerabilities
class
SupportingMessage
<
ApplicationRecord
self
.
table_name
=
'vulnerability_finding_evidence_supporting_messages'
belongs_to
:evidence
,
class_name:
'Vulnerabilities::Finding::Evidence'
,
inverse_of: :supporting_message
,
foreign_key:
'vulnerability_finding_evidence_id'
,
optional:
false
belongs_to
:evidence
,
class_name:
'Vulnerabilities::Finding::Evidence'
,
inverse_of: :supporting_messages
,
foreign_key:
'vulnerability_finding_evidence_id'
,
optional:
false
has_one
:request
,
class_name:
'Vulnerabilities::Finding::Evidence::Request'
,
inverse_of: :supporting_message
,
foreign_key:
'vulnerability_finding_evidence_supporting_message_id'
has_one
:response
,
class_name:
'Vulnerabilities::Finding::Evidence::Response'
,
inverse_of: :supporting_message
,
foreign_key:
'vulnerability_finding_evidence_supporting_message_id'
has_one
:request
,
class_name:
'Vulnerabilities::Finding::Evidence::Request'
,
inverse_of: :supporting_message
,
foreign_key:
'vulnerability_finding_evidence_supporting_message_id'
has_one
:response
,
class_name:
'Vulnerabilities::Finding::Evidence::Response'
,
inverse_of: :supporting_message
,
foreign_key:
'vulnerability_finding_evidence_supporting_message_id'
validates
:name
,
length:
{
maximum:
2048
},
presence:
true
end
...
...
ee/spec/models/vulnerabilities/finding/evidence/supporting_message_spec.rb
View file @
0a290327
...
...
@@ -3,9 +3,27 @@
require
'spec_helper'
RSpec
.
describe
Vulnerabilities
::
Finding
::
Evidence
::
SupportingMessage
do
it
{
is_expected
.
to
belong_to
(
:evidence
).
class_name
(
'Vulnerabilities::Finding::Evidence'
).
inverse_of
(
:supporting_message
).
required
}
it
{
is_expected
.
to
have_one
(
:request
).
class_name
(
'Vulnerabilities::Finding::Evidence::Request'
).
with_foreign_key
(
'vulnerability_finding_evidence_supporting_message_id'
).
inverse_of
(
:supporting_message
)
}
it
{
is_expected
.
to
have_one
(
:response
).
class_name
(
'Vulnerabilities::Finding::Evidence::Response'
).
with_foreign_key
(
'vulnerability_finding_evidence_supporting_message_id'
).
inverse_of
(
:supporting_message
)
}
it
{
is_expected
.
to
belong_to
(
:evidence
)
.
class_name
(
'Vulnerabilities::Finding::Evidence'
)
.
inverse_of
(
:supporting_messages
)
.
required
}
it
{
is_expected
.
to
have_one
(
:request
)
.
class_name
(
'Vulnerabilities::Finding::Evidence::Request'
)
.
with_foreign_key
(
'vulnerability_finding_evidence_supporting_message_id'
)
.
inverse_of
(
:supporting_message
)
}
it
{
is_expected
.
to
have_one
(
:response
)
.
class_name
(
'Vulnerabilities::Finding::Evidence::Response'
)
.
with_foreign_key
(
'vulnerability_finding_evidence_supporting_message_id'
)
.
inverse_of
(
:supporting_message
)
}
it
{
is_expected
.
to
validate_length_of
(
:name
).
is_at_most
(
2048
)
}
it
{
is_expected
.
to
validate_presence_of
(
:name
)
}
...
...
ee/spec/models/vulnerabilities/finding/evidence_spec.rb
View file @
0a290327
...
...
@@ -3,12 +3,47 @@
require
'spec_helper'
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::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
have_one
(
:supporting_message
).
class_name
(
'Vulnerabilities::Finding::Evidence::SupportingMessage'
).
with_foreign_key
(
'vulnerability_finding_evidence_id'
).
inverse_of
(
:evidence
)
}
it
{
is_expected
.
to
have_one
(
:source
).
class_name
(
'Vulnerabilities::Finding::Evidence::Source'
).
with_foreign_key
(
'vulnerability_finding_evidence_id'
).
inverse_of
(
:evidence
)
}
it
{
is_expected
.
to
have_many
(
:assets
).
class_name
(
'Vulnerabilities::Finding::Evidence::Asset'
).
with_foreign_key
(
'vulnerability_finding_evidence_id'
).
inverse_of
(
:evidence
)
}
it
{
is_expected
.
to
belong_to
(
:finding
)
.
class_name
(
'Vulnerabilities::Finding'
)
.
required
}
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
have_one
(
:source
)
.
class_name
(
'Vulnerabilities::Finding::Evidence::Source'
)
.
with_foreign_key
(
'vulnerability_finding_evidence_id'
)
.
inverse_of
(
:evidence
)
}
it
{
is_expected
.
to
have_many
(
:supporting_messages
)
.
class_name
(
'Vulnerabilities::Finding::Evidence::SupportingMessage'
)
.
with_foreign_key
(
'vulnerability_finding_evidence_id'
)
.
inverse_of
(
:evidence
)
}
it
{
is_expected
.
to
have_many
(
:assets
)
.
class_name
(
'Vulnerabilities::Finding::Evidence::Asset'
)
.
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
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