From cee318e2cd03ea08562dce6bf868fe707a7f270b Mon Sep 17 00:00:00 2001 From: samdbeckham Date: Thu, 29 Aug 2019 11:31:07 +0100 Subject: [PATCH 1/2] Ports the MR DAST reports logic to the backend - Copies over all the changes from the similar MRs for dependency and container scanning. - Everything is behind an inactive feature flag --- .../grouped_security_reports_app.vue | 16 +- .../security_reports/store/actions.js | 27 ++++ .../security_reports/store/mutation_types.js | 2 + .../security_reports/store/mutations.js | 13 ++ .../security_reports/store/state.js | 1 + .../security_reports/store/mutations_spec.js | 58 +++++++ .../grouped_security_reports_app_spec.js | 46 ++++++ .../security_reports/store/actions_spec.js | 143 ++++++++++++++++++ 8 files changed, 304 insertions(+), 2 deletions(-) diff --git a/ee/app/assets/javascripts/vue_shared/security_reports/grouped_security_reports_app.vue b/ee/app/assets/javascripts/vue_shared/security_reports/grouped_security_reports_app.vue index 83fd2ccf7dd035..eb355437a8f83c 100644 --- a/ee/app/assets/javascripts/vue_shared/security_reports/grouped_security_reports_app.vue +++ b/ee/app/assets/javascripts/vue_shared/security_reports/grouped_security_reports_app.vue @@ -176,6 +176,11 @@ export default { shouldRenderDependencyScanning() { const { head, diffEndpoint } = this.dependencyScanning.paths; + return head || diffEndpoint; + }, + shouldRenderDast() { + const { head, diffEndpoint } = this.dast.paths; + return head || diffEndpoint; }, }, @@ -225,7 +230,12 @@ export default { this.fetchSastContainerReports(); } - if (this.dastHeadPath) { + const dastDiffEndpoint = gl && gl.mrWidgetData && gl.mrWidgetData.dast_comparison_path; + + if (gon.features && gon.features.dastMergeRequestReportApi && dastDiffEndpoint) { + this.setDastDiffEndpoint(dastDiffEndpoint); + this.fetchDastDiff(); + } else if (this.dastHeadPath) { this.setDastHeadPath(this.dastHeadPath); if (this.dastBasePath) { @@ -291,6 +301,8 @@ export default { 'setSastContainerDiffEndpoint', 'fetchDependencyScanningDiff', 'setDependencyScanningDiffEndpoint', + 'fetchDastDiff', + 'setDastDiffEndpoint', ]), ...mapActions('sast', { setSastHeadPath: 'setHeadPath', @@ -373,7 +385,7 @@ export default { /> -