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
37cfbf80
Commit
37cfbf80
authored
Oct 09, 2019
by
Victor Zagorodny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename VulnerabilityFindingsFinder dependencies
parent
b93016ef
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
9 deletions
+11
-9
ee/app/controllers/groups/security/vulnerabilities_controller.rb
...controllers/groups/security/vulnerabilities_controller.rb
+1
-1
ee/lib/gitlab/vulnerabilities/history.rb
ee/lib/gitlab/vulnerabilities/history.rb
+4
-4
ee/lib/gitlab/vulnerabilities/history_cache.rb
ee/lib/gitlab/vulnerabilities/history_cache.rb
+4
-2
ee/spec/lib/gitlab/vulnerabilities/history_spec.rb
ee/spec/lib/gitlab/vulnerabilities/history_spec.rb
+2
-2
No files found.
ee/app/controllers/groups/security/vulnerabilities_controller.rb
View file @
37cfbf80
...
...
@@ -7,7 +7,7 @@ class Groups::Security::VulnerabilitiesController < Groups::ApplicationControlle
alias_method
:vulnerable
,
:group
def
history
history_count
=
Gitlab
::
Vulnerabilities
::
History
.
new
(
group
,
filter_params
).
vulnerabilitie
s_counter
history_count
=
Gitlab
::
Vulnerabilities
::
History
.
new
(
group
,
filter_params
).
finding
s_counter
respond_to
do
|
format
|
format
.
json
do
...
...
ee/lib/gitlab/vulnerabilities/history.rb
View file @
37cfbf80
...
...
@@ -14,16 +14,16 @@ module Gitlab
@filters
=
filters
end
def
vulnerabilitie
s_counter
def
finding
s_counter
return
cached_vulnerability_history
if
use_vulnerability_cache?
vulnerabilities
=
found_vulnerabilitie
s
.
count_by_day_and_severity
(
HISTORY_RANGE
)
::
Vulnerabilities
::
HistorySerializer
.
new
.
represent
(
vulnerabilitie
s
)
findings
=
vulnerability_finding
s
.
count_by_day_and_severity
(
HISTORY_RANGE
)
::
Vulnerabilities
::
HistorySerializer
.
new
.
represent
(
finding
s
)
end
private
def
found_vulnerabilitie
s
def
vulnerability_finding
s
::
Security
::
VulnerabilityFindingsFinder
.
new
(
group
,
params:
filters
).
execute
(
:all
)
end
...
...
ee/lib/gitlab/vulnerabilities/history_cache.rb
View file @
37cfbf80
...
...
@@ -12,17 +12,19 @@ module Gitlab
def
fetch
(
range
,
force:
false
)
Rails
.
cache
.
fetch
(
cache_key
,
force:
force
,
expires_in:
1
.
day
)
do
vulnerabilitie
s
=
::
Security
::
VulnerabilityFindingsFinder
finding
s
=
::
Security
::
VulnerabilityFindingsFinder
.
new
(
group
,
params:
{
project_id:
[
project_id
]
})
.
execute
(
:all
)
.
count_by_day_and_severity
(
range
)
::
Vulnerabilities
::
HistorySerializer
.
new
.
represent
(
vulnerabilitie
s
)
::
Vulnerabilities
::
HistorySerializer
.
new
.
represent
(
finding
s
)
end
end
private
def
cache_key
# TODO: rename 'vulnerabilities' to 'findings' in the cache key, but carefully
# https://gitlab.com/gitlab-org/gitlab/issues/32963
[
'projects'
,
project_id
,
'vulnerabilities'
]
end
end
...
...
ee/spec/lib/gitlab/vulnerabilities/history_spec.rb
View file @
37cfbf80
...
...
@@ -13,8 +13,8 @@ describe Gitlab::Vulnerabilities::History do
create_vulnerabilities
(
2
,
project2
,
{
severity: :high
,
report_type: :sast
})
end
describe
'#
vulnerabilitie
s_counter'
,
:use_clean_rails_memory_store_caching
do
subject
(
:counter
)
{
described_class
.
new
(
group
,
filters
).
vulnerabilitie
s_counter
}
describe
'#
finding
s_counter'
,
:use_clean_rails_memory_store_caching
do
subject
(
:counter
)
{
described_class
.
new
(
group
,
filters
).
finding
s_counter
}
context
'feature disabled'
do
before
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