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
e2a74490
Commit
e2a74490
authored
Oct 26, 2020
by
Alan (Maciej) Paruszewski
Committed by
Stan Hu
Oct 26, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update pipeline when vulnerability dismissal feedback is created
parent
8ba7dfae
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
2 deletions
+23
-2
ee/app/assets/javascripts/vue_shared/security_reports/store/actions.js
.../javascripts/vue_shared/security_reports/store/actions.js
+1
-0
ee/app/models/vulnerabilities/feedback.rb
ee/app/models/vulnerabilities/feedback.rb
+7
-0
ee/app/services/vulnerabilities/dismiss_service.rb
ee/app/services/vulnerabilities/dismiss_service.rb
+2
-1
ee/changelogs/unreleased/254228-save-pipeline-when-creating-dismissal-feedback.yml
...254228-save-pipeline-when-creating-dismissal-feedback.yml
+5
-0
ee/spec/frontend/vue_shared/security_reports/store/actions_spec.js
...rontend/vue_shared/security_reports/store/actions_spec.js
+1
-0
ee/spec/services/vulnerabilities/dismiss_service_spec.rb
ee/spec/services/vulnerabilities/dismiss_service_spec.rb
+3
-1
ee/spec/services/vulnerability_feedback/create_service_spec.rb
...ec/services/vulnerability_feedback/create_service_spec.rb
+4
-0
No files found.
ee/app/assets/javascripts/vue_shared/security_reports/store/actions.js
View file @
e2a74490
...
...
@@ -370,6 +370,7 @@ export const revertDismissVulnerability = ({ state, dispatch }) => {
...
state
.
modal
.
vulnerability
,
isDismissed
:
false
,
dismissalFeedback
:
null
,
dismissal_feedback
:
null
,
};
dispatch
(
'
receiveDismissVulnerability
'
,
updatedIssue
);
...
...
ee/app/models/vulnerabilities/feedback.rb
View file @
e2a74490
...
...
@@ -34,6 +34,9 @@ module Vulnerabilities
preload
(
:author
,
:comment_author
,
:project
,
:issue
,
:merge_request
,
:pipeline
)
end
after_save
:touch_pipeline
,
if: :for_dismissal?
after_destroy
:touch_pipeline
,
if: :for_dismissal?
# TODO remove once filtered data has been cleaned
def
self
.
only_valid_feedback
pipeline
=
Ci
::
Pipeline
.
arel_table
...
...
@@ -83,5 +86,9 @@ module Vulnerabilities
project_fingerprint:
project_fingerprint
}
end
def
touch_pipeline
pipeline
&
.
touch
end
end
end
ee/app/services/vulnerabilities/dismiss_service.rb
View file @
e2a74490
...
...
@@ -39,7 +39,8 @@ module Vulnerabilities
category:
finding
.
report_type
,
feedback_type:
'dismissal'
,
project_fingerprint:
finding
.
project_fingerprint
,
comment:
@comment
comment:
@comment
,
pipeline:
@project
.
latest_pipeline_with_security_reports
(
only_successful:
true
)
}
end
...
...
ee/changelogs/unreleased/254228-save-pipeline-when-creating-dismissal-feedback.yml
0 → 100644
View file @
e2a74490
---
title
:
Update pipeline when vulnerability dismissal feedback is created
merge_request
:
45954
author
:
type
:
fixed
ee/spec/frontend/vue_shared/security_reports/store/actions_spec.js
View file @
e2a74490
...
...
@@ -94,6 +94,7 @@ const createNonDismissedVulnerability = options =>
...
options
,
isDismissed
:
false
,
dismissalFeedback
:
null
,
dismissal_feedback
:
null
,
});
const
createDismissedVulnerability
=
options
=>
...
...
ee/spec/services/vulnerabilities/dismiss_service_spec.rb
View file @
e2a74490
...
...
@@ -11,6 +11,8 @@ RSpec.describe Vulnerabilities::DismissService do
let_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
# cannot use let_it_be here: caching causes problems with permission-related tests
let!
(
:pipeline
)
{
create
(
:ci_pipeline
,
:success
,
project:
project
)
}
let!
(
:build
)
{
create
(
:ee_ci_build
,
:sast
,
pipeline:
pipeline
)
}
let
(
:vulnerability
)
{
create
(
:vulnerability
,
:with_findings
,
project:
project
)
}
let
(
:service
)
{
described_class
.
new
(
user
,
vulnerability
)
}
...
...
@@ -46,7 +48,7 @@ RSpec.describe Vulnerabilities::DismissService do
have_attributes
(
state:
'dismissed'
,
dismissed_by:
user
,
dismissed_at:
be_like_time
(
Time
.
current
)))
expect
(
vulnerability
.
findings
).
to
all
have_vulnerability_dismissal_feedback
expect
(
vulnerability
.
findings
.
map
(
&
:dismissal_feedback
)).
to
(
all
(
have_attributes
(
comment:
comment
,
comment_author:
user
,
comment_timestamp:
be_like_time
(
Time
.
current
))))
all
(
have_attributes
(
comment:
comment
,
comment_author:
user
,
comment_timestamp:
be_like_time
(
Time
.
current
)
,
pipeline_id:
pipeline
.
id
)))
end
end
end
...
...
ee/spec/services/vulnerability_feedback/create_service_spec.rb
View file @
e2a74490
...
...
@@ -60,6 +60,10 @@ RSpec.describe VulnerabilityFeedback::CreateService, '#execute' do
expect
(
feedback
.
merge_request
).
to
be_nil
end
it
'touches pipeline related to feedback'
do
expect
{
result
}.
to
change
{
pipeline
.
reload
.
updated_at
}
end
context
'when feedback params has a comment'
do
it
'sets the comment attributes'
do
feedback
=
result
[
:vulnerability_feedback
]
...
...
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