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
e7d5b2c6
Commit
e7d5b2c6
authored
May 17, 2021
by
Jonathan Schafer
Committed by
Vasilii Iakliushin
May 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add limits to ruby to match DB limits
Added tests
parent
74b7bc04
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
0 deletions
+18
-0
ee/app/models/vulnerabilities/findings/evidence.rb
ee/app/models/vulnerabilities/findings/evidence.rb
+2
-0
ee/app/models/vulnerabilities/findings/evidences/request.rb
ee/app/models/vulnerabilities/findings/evidences/request.rb
+4
-0
ee/app/models/vulnerabilities/findings/evidences/response.rb
ee/app/models/vulnerabilities/findings/evidences/response.rb
+3
-0
ee/spec/models/vulnerabilities/findings/evidence_spec.rb
ee/spec/models/vulnerabilities/findings/evidence_spec.rb
+2
-0
ee/spec/models/vulnerabilities/findings/evidences/request_spec.rb
...models/vulnerabilities/findings/evidences/request_spec.rb
+4
-0
ee/spec/models/vulnerabilities/findings/evidences/response_spec.rb
...odels/vulnerabilities/findings/evidences/response_spec.rb
+3
-0
No files found.
ee/app/models/vulnerabilities/findings/evidence.rb
View file @
e7d5b2c6
...
@@ -9,6 +9,8 @@ module Vulnerabilities
...
@@ -9,6 +9,8 @@ module Vulnerabilities
has_one
:request
,
class_name:
'Vulnerabilities::Findings::Evidences::Request'
,
inverse_of: :evidence
,
foreign_key:
'vulnerability_finding_evidence_id'
has_one
:request
,
class_name:
'Vulnerabilities::Findings::Evidences::Request'
,
inverse_of: :evidence
,
foreign_key:
'vulnerability_finding_evidence_id'
has_one
:response
,
class_name:
'Vulnerabilities::Findings::Evidences::Response'
,
inverse_of: :evidence
,
foreign_key:
'vulnerability_finding_evidence_id'
has_one
:response
,
class_name:
'Vulnerabilities::Findings::Evidences::Response'
,
inverse_of: :evidence
,
foreign_key:
'vulnerability_finding_evidence_id'
validates
:summary
,
length:
{
maximum:
8_000_000
}
end
end
end
end
end
end
ee/app/models/vulnerabilities/findings/evidences/request.rb
View file @
e7d5b2c6
...
@@ -7,6 +7,10 @@ module Vulnerabilities
...
@@ -7,6 +7,10 @@ module Vulnerabilities
self
.
table_name
=
'vulnerability_finding_evidence_requests'
self
.
table_name
=
'vulnerability_finding_evidence_requests'
belongs_to
:evidence
,
class_name:
'Vulnerabilities::Findings::Evidence'
,
inverse_of: :request
,
foreign_key:
'vulnerability_finding_evidence_id'
,
optional:
false
belongs_to
:evidence
,
class_name:
'Vulnerabilities::Findings::Evidence'
,
inverse_of: :request
,
foreign_key:
'vulnerability_finding_evidence_id'
,
optional:
false
validates
:method
,
length:
{
maximum:
32
}
validates
:url
,
length:
{
maximum:
2048
}
validates
:body
,
length:
{
maximum:
2048
}
end
end
end
end
end
end
...
...
ee/app/models/vulnerabilities/findings/evidences/response.rb
View file @
e7d5b2c6
...
@@ -7,6 +7,9 @@ module Vulnerabilities
...
@@ -7,6 +7,9 @@ module Vulnerabilities
self
.
table_name
=
'vulnerability_finding_evidence_responses'
self
.
table_name
=
'vulnerability_finding_evidence_responses'
belongs_to
:evidence
,
class_name:
'Vulnerabilities::Findings::Evidence'
,
inverse_of: :response
,
foreign_key:
'vulnerability_finding_evidence_id'
,
optional:
false
belongs_to
:evidence
,
class_name:
'Vulnerabilities::Findings::Evidence'
,
inverse_of: :response
,
foreign_key:
'vulnerability_finding_evidence_id'
,
optional:
false
validates
:reason_phrase
,
length:
{
maximum:
2048
}
validates
:body
,
length:
{
maximum:
2048
}
end
end
end
end
end
end
...
...
ee/spec/models/vulnerabilities/findings/evidence_spec.rb
View file @
e7d5b2c6
...
@@ -6,4 +6,6 @@ RSpec.describe Vulnerabilities::Findings::Evidence do
...
@@ -6,4 +6,6 @@ RSpec.describe Vulnerabilities::Findings::Evidence do
it
{
is_expected
.
to
belong_to
(
:finding
).
class_name
(
'Vulnerabilities::Finding'
).
required
}
it
{
is_expected
.
to
belong_to
(
:finding
).
class_name
(
'Vulnerabilities::Finding'
).
required
}
it
{
is_expected
.
to
have_one
(
:request
).
class_name
(
'Vulnerabilities::Findings::Evidences::Request'
).
with_foreign_key
(
'vulnerability_finding_evidence_id'
).
inverse_of
(
:evidence
)
}
it
{
is_expected
.
to
have_one
(
:request
).
class_name
(
'Vulnerabilities::Findings::Evidences::Request'
).
with_foreign_key
(
'vulnerability_finding_evidence_id'
).
inverse_of
(
:evidence
)
}
it
{
is_expected
.
to
have_one
(
:response
).
class_name
(
'Vulnerabilities::Findings::Evidences::Response'
).
with_foreign_key
(
'vulnerability_finding_evidence_id'
).
inverse_of
(
:evidence
)
}
it
{
is_expected
.
to
have_one
(
:response
).
class_name
(
'Vulnerabilities::Findings::Evidences::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
end
ee/spec/models/vulnerabilities/findings/evidences/request_spec.rb
View file @
e7d5b2c6
...
@@ -4,4 +4,8 @@ require 'spec_helper'
...
@@ -4,4 +4,8 @@ require 'spec_helper'
RSpec
.
describe
Vulnerabilities
::
Findings
::
Evidences
::
Request
do
RSpec
.
describe
Vulnerabilities
::
Findings
::
Evidences
::
Request
do
it
{
is_expected
.
to
belong_to
(
:evidence
).
class_name
(
'Vulnerabilities::Findings::Evidence'
).
inverse_of
(
:request
).
required
}
it
{
is_expected
.
to
belong_to
(
:evidence
).
class_name
(
'Vulnerabilities::Findings::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
)
}
it
{
is_expected
.
to
validate_length_of
(
:body
).
is_at_most
(
2048
)
}
end
end
ee/spec/models/vulnerabilities/findings/evidences/response_spec.rb
View file @
e7d5b2c6
...
@@ -4,4 +4,7 @@ require 'spec_helper'
...
@@ -4,4 +4,7 @@ require 'spec_helper'
RSpec
.
describe
Vulnerabilities
::
Findings
::
Evidences
::
Response
do
RSpec
.
describe
Vulnerabilities
::
Findings
::
Evidences
::
Response
do
it
{
is_expected
.
to
belong_to
(
:evidence
).
class_name
(
'Vulnerabilities::Findings::Evidence'
).
inverse_of
(
:response
).
required
}
it
{
is_expected
.
to
belong_to
(
:evidence
).
class_name
(
'Vulnerabilities::Findings::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
)
}
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