Commit 94c10b53 authored by Jonathan Schafer's avatar Jonathan Schafer

Add ability to create MR from a vulnerability

parent 47ed79de
...@@ -14,6 +14,8 @@ module VulnerabilitiesHelper ...@@ -14,6 +14,8 @@ module VulnerabilitiesHelper
has_mr: !!vulnerability.finding.merge_request_feedback.try(:merge_request_iid), has_mr: !!vulnerability.finding.merge_request_feedback.try(:merge_request_iid),
vulnerability_feedback_help_path: help_page_path('user/application_security/index', anchor: 'interacting-with-the-vulnerabilities'), vulnerability_feedback_help_path: help_page_path('user/application_security/index', anchor: 'interacting-with-the-vulnerabilities'),
finding_json: vulnerability_finding_data(vulnerability.finding).to_json, finding_json: vulnerability_finding_data(vulnerability.finding).to_json,
source_branch: pipeline&.ref.to_s,
create_mr_url: create_vulnerability_feedback_merge_request_path(vulnerability.finding.project),
timestamp: Time.now.to_i timestamp: Time.now.to_i
} }
end end
...@@ -40,7 +42,8 @@ module VulnerabilitiesHelper ...@@ -40,7 +42,8 @@ module VulnerabilitiesHelper
:name, :name,
:issue_feedback, :issue_feedback,
:merge_request_feedback, :merge_request_feedback,
:project :project,
:remediations
).merge( ).merge(
solution: remediation ? remediation['summary'] : occurrence[:solution] solution: remediation ? remediation['summary'] : occurrence[:solution]
) )
......
...@@ -30,6 +30,7 @@ describe VulnerabilitiesHelper do ...@@ -30,6 +30,7 @@ describe VulnerabilitiesHelper do
:name, :name,
:issue_feedback, :issue_feedback,
:project, :project,
:remediations,
:solution :solution
) )
end end
...@@ -64,6 +65,8 @@ describe VulnerabilitiesHelper do ...@@ -64,6 +65,8 @@ describe VulnerabilitiesHelper do
has_mr: anything, has_mr: anything,
vulnerability_feedback_help_path: kind_of(String), vulnerability_feedback_help_path: kind_of(String),
finding_json: kind_of(String), finding_json: kind_of(String),
source_branch: kind_of(String),
create_mr_url: "/#{project.full_path}/-/vulnerability_feedback",
timestamp: Time.now.to_i timestamp: Time.now.to_i
) )
end end
...@@ -113,6 +116,7 @@ describe VulnerabilitiesHelper do ...@@ -113,6 +116,7 @@ describe VulnerabilitiesHelper do
location: finding.location, location: finding.location,
name: finding.name, name: finding.name,
project: kind_of(Grape::Entity::Exposure::NestingExposure::OutputBuilder), project: kind_of(Grape::Entity::Exposure::NestingExposure::OutputBuilder),
remediations: finding.remediations,
solution: kind_of(String) solution: kind_of(String)
) )
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment