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
b9197e95
Commit
b9197e95
authored
Nov 07, 2018
by
Olivier Gonzalez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix scoping vulns on group dashboard
Ensure we only filter pipeline that effectively have vulnerabilties.
parent
dcffe1f7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
1 deletion
+20
-1
ee/app/models/ee/ci/pipeline.rb
ee/app/models/ee/ci/pipeline.rb
+4
-0
ee/app/models/ee/group.rb
ee/app/models/ee/group.rb
+1
-1
ee/spec/models/ci/pipeline_spec.rb
ee/spec/models/ci/pipeline_spec.rb
+15
-0
No files found.
ee/app/models/ee/ci/pipeline.rb
View file @
b9197e95
...
...
@@ -25,6 +25,10 @@ module EE
where
(
'EXISTS (?)'
,
::
Ci
::
Build
.
latest
.
with_security_reports
.
where
(
'ci_pipelines.id=ci_builds.commit_id'
).
select
(
1
))
end
scope
:with_vulnerabilities
,
->
do
where
(
'EXISTS (?)'
,
::
Vulnerabilities
::
OccurrencePipeline
.
where
(
'ci_pipelines.id=vulnerability_occurrence_pipelines.pipeline_id'
).
select
(
1
))
end
# This structure describes feature levels
# to access the file types for given reports
REPORT_LICENSED_FEATURES
=
{
...
...
ee/app/models/ee/group.rb
View file @
b9197e95
...
...
@@ -84,7 +84,7 @@ module EE
def
latest_vulnerabilities
Vulnerabilities
::
Occurrence
.
for_pipelines
(
all_pipelines
.
latest_successful_ids_per_project
)
.
for_pipelines
(
all_pipelines
.
with_vulnerabilities
.
latest_successful_ids_per_project
)
end
def
human_ldap_access
...
...
ee/spec/models/ci/pipeline_spec.rb
View file @
b9197e95
...
...
@@ -40,6 +40,21 @@ describe Ci::Pipeline do
end
end
describe
'#with_vulnerabilities scope'
do
let!
(
:pipeline_1
)
{
create
(
:ci_pipeline_without_jobs
,
project:
project
)
}
let!
(
:pipeline_2
)
{
create
(
:ci_pipeline_without_jobs
,
project:
project
)
}
let!
(
:pipeline_3
)
{
create
(
:ci_pipeline_without_jobs
,
project:
project
)
}
before
do
create
(
:vulnerabilities_occurrence
,
pipelines:
[
pipeline_1
],
project:
pipeline
.
project
)
create
(
:vulnerabilities_occurrence
,
pipelines:
[
pipeline_2
],
project:
pipeline
.
project
)
end
it
"returns pipeline with vulnerabilities"
do
expect
(
described_class
.
with_vulnerabilities
).
to
contain_exactly
(
pipeline_1
,
pipeline_2
)
end
end
shared_examples
'unlicensed report type'
do
context
'when there is no licensed feature for artifact file type'
do
it
'returns the artifact'
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