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
04456776
Commit
04456776
authored
Sep 13, 2021
by
Subashis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use disable join for cross db
parent
ae63ee79
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
11 deletions
+21
-11
config/feature_flags/development/finding_ci_pipeline_disable_joins.yml
...e_flags/development/finding_ci_pipeline_disable_joins.yml
+8
-0
ee/app/controllers/projects/security/vulnerabilities_controller.rb
...ntrollers/projects/security/vulnerabilities_controller.rb
+1
-1
ee/app/models/vulnerabilities/finding.rb
ee/app/models/vulnerabilities/finding.rb
+10
-7
ee/app/presenters/vulnerability_presenter.rb
ee/app/presenters/vulnerability_presenter.rb
+1
-1
ee/spec/factories/vulnerabilities/findings.rb
ee/spec/factories/vulnerabilities/findings.rb
+1
-2
No files found.
config/feature_flags/development/finding_ci_pipeline_disable_joins.yml
0 → 100644
View file @
04456776
---
name
:
finding_ci_pipeline_disable_joins
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70216
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/338665
milestone
:
'
14.3'
type
:
development
group
:
group::threat insights
default_enabled
:
true
ee/app/controllers/projects/security/vulnerabilities_controller.rb
View file @
04456776
...
...
@@ -19,7 +19,7 @@ module Projects
feature_category
:vulnerability_management
def
show
pipeline
=
vulnerability
.
finding
.
pipelines
.
first
pipeline
=
vulnerability
.
finding
.
first_finding_pipeline
@pipeline
=
pipeline
if
Ability
.
allowed?
(
current_user
,
:read_pipeline
,
pipeline
)
@gfm_form
=
true
end
...
...
ee/app/models/vulnerabilities/finding.rb
View file @
04456776
...
...
@@ -38,7 +38,7 @@ module Vulnerabilities
has_many
:remediations
,
through: :finding_remediations
has_many
:finding_pipelines
,
class_name:
'Vulnerabilities::FindingPipeline'
,
inverse_of: :finding
,
foreign_key:
'occurrence_id'
has_many
:pipelines
,
through: :finding_pipelines
,
class_name:
'Ci::Pipeline'
has_many
:pipelines
,
through: :finding_pipelines
,
class_name:
'Ci::Pipeline'
,
disable_joins:
->
{
::
Feature
.
enabled?
(
:finding_ci_pipeline_disable_joins
,
default_enabled: :yaml
)
}
has_many
:signatures
,
class_name:
'Vulnerabilities::FindingSignature'
,
inverse_of: :finding
...
...
@@ -105,11 +105,6 @@ module Vulnerabilities
.
where
(
"vulnerability_occurrences.location -> 'image' ?| array[:images]"
,
images:
images
)
end
def
self
.
for_pipelines
(
pipelines
)
joins
(
:finding_pipelines
)
.
where
(
vulnerability_occurrence_pipelines:
{
pipeline_id:
pipelines
})
end
def
self
.
counted_by_severity
group
(
:severity
).
count
.
transform_keys
do
|
severity
|
severities
[
severity
]
...
...
@@ -368,13 +363,21 @@ module Vulnerabilities
end
def
pipeline_branch
pipelines
&
.
last
&
.
sha
||
project
.
default_branch
last_finding_pipeline
&
.
sha
||
project
.
default_branch
end
def
false_positive?
vulnerability_flags
.
false_positive
.
any?
end
def
first_finding_pipeline
finding_pipelines
.
first
&
.
pipeline
end
def
last_finding_pipeline
finding_pipelines
.
last
&
.
pipeline
end
protected
def
primary_identifier_fingerprint
...
...
ee/app/presenters/vulnerability_presenter.rb
View file @
04456776
...
...
@@ -69,7 +69,7 @@ class VulnerabilityPresenter < Gitlab::View::Presenter::Delegated
end
def
pipeline_branch
finding
.
pipeline
s
&
.
last
&
.
sha
||
project
.
default
_branch
finding
.
pipeline_branch
end
def
path_with_line_number
(
path
)
...
...
ee/spec/factories/vulnerabilities/findings.rb
View file @
04456776
...
...
@@ -235,8 +235,7 @@ FactoryBot.define do
trait
:with_pipeline
do
after
(
:create
)
do
|
finding
|
pipeline
=
create
(
:ci_pipeline
,
project:
finding
.
project
)
finding
.
pipelines
=
[
pipeline
]
create
(
:vulnerabilities_finding_pipeline
,
finding:
finding
,
pipeline:
pipeline
)
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