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
64932d96
Commit
64932d96
authored
Mar 10, 2021
by
Jonathan Schafer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename with_scanners to with_scanner_external_ids
parent
e7960aa6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
ee/app/finders/security/vulnerabilities_finder.rb
ee/app/finders/security/vulnerabilities_finder.rb
+3
-3
ee/app/models/ee/vulnerability.rb
ee/app/models/ee/vulnerability.rb
+1
-1
ee/spec/models/ee/vulnerability_spec.rb
ee/spec/models/ee/vulnerability_spec.rb
+4
-4
No files found.
ee/app/finders/security/vulnerabilities_finder.rb
View file @
64932d96
...
...
@@ -30,7 +30,7 @@ module Security
filter_by_report_types
filter_by_severities
filter_by_states
filter_by_scanner
s
filter_by_scanner
_external_id
filter_by_resolution
filter_by_issues
...
...
@@ -65,9 +65,9 @@ module Security
end
end
def
filter_by_scanner
s
def
filter_by_scanner
_external_id
if
params
[
:scanner
].
present?
@vulnerabilities
=
vulnerabilities
.
with_scanners
(
params
[
:scanner
])
@vulnerabilities
=
vulnerabilities
.
with_scanner
_external_id
s
(
params
[
:scanner
])
end
end
...
...
ee/app/models/ee/vulnerability.rb
View file @
64932d96
...
...
@@ -82,7 +82,7 @@ module EE
scope
:with_report_types
,
->
(
report_types
)
{
where
(
report_type:
report_types
)
}
scope
:with_severities
,
->
(
severities
)
{
where
(
severity:
severities
)
}
scope
:with_states
,
->
(
states
)
{
where
(
state:
states
)
}
scope
:with_scanners
,
->
(
scanners
)
{
joins
(
findings: :scanner
).
merge
(
::
Vulnerabilities
::
Scanner
.
with_external_id
(
scanners
))
}
scope
:with_scanner
_external_id
s
,
->
(
scanners
)
{
joins
(
findings: :scanner
).
merge
(
::
Vulnerabilities
::
Scanner
.
with_external_id
(
scanners
))
}
scope
:grouped_by_severity
,
->
{
reorder
(
severity: :desc
).
group
(
:severity
)
}
scope
:by_project_fingerprints
,
->
(
project_fingerprints
)
{
joins
(
:findings
).
merge
(
Vulnerabilities
::
Finding
.
by_project_fingerprints
(
project_fingerprints
))
}
...
...
ee/spec/models/ee/vulnerability_spec.rb
View file @
64932d96
...
...
@@ -223,15 +223,15 @@ RSpec.describe Vulnerability do
end
end
describe
'.with_scanners'
do
describe
'.with_scanner
_external_id
s'
do
let!
(
:vulnerability_1
)
{
create
(
:vulnerability
,
:with_findings
)
}
let!
(
:vulnerability_2
)
{
create
(
:vulnerability
,
:with_findings
)
}
let
(
:vulnerability_3
)
{
vulnerability
}
let
(
:scanners
)
{
[
vulnerability_1
.
finding_scanner_external_id
,
vulnerability_3
.
finding_scanner_external_id
]
}
let
(
:scanner
_external_id
s
)
{
[
vulnerability_1
.
finding_scanner_external_id
,
vulnerability_3
.
finding_scanner_external_id
]
}
subject
{
described_class
.
with_scanner
s
(
scanner
s
)
}
subject
{
described_class
.
with_scanner
_external_ids
(
scanner_external_id
s
)
}
it
'returns vulnerabilities matching the given scanners'
do
it
'returns vulnerabilities matching the given scanner
external id
s'
do
is_expected
.
to
contain_exactly
(
vulnerability_1
,
vulnerability_3
)
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