Skip to content

Add ability to edit existing on-demand DAST scans

Paul Gascou-Vaillancourt requested to merge 295242-saved-scans-edit-mode into master

What does this MR do?

This adds the ability to edit saved DAST scans.

How to test this?

  1. Enable the feature flag:
echo "Feature.enable(:dast_saved_scans)" | rails c
  1. Mock the API by applying the following patch:
diff --git a/ee/app/assets/javascripts/on_demand_scans/graphql/provider.js b/ee/app/assets/javascripts/on_demand_scans/graphql/provider.js
index ef96b443da8..dc39a1bf237 100644
--- a/ee/app/assets/javascripts/on_demand_scans/graphql/provider.js
+++ b/ee/app/assets/javascripts/on_demand_scans/graphql/provider.js
@@ -4,6 +4,20 @@ import createDefaultClient from '~/lib/graphql';
 
 Vue.use(VueApollo);
 
+const resolvers = {
+  Mutation: {
+    dastScanUpdate: () => {
+      return {
+        dastScan: {
+          editPath: '/your/scan/edit/page',
+        },
+        pipelineUrl: '/your/dast/pipeline',
+        errors: [],
+      };
+    },
+  },
+};
+
 export default new VueApollo({
-  defaultClient: createDefaultClient(),
+  defaultClient: createDefaultClient(resolvers),
 });
  1. Browse to the edit DAST scan page at /:namespace/:project/-/on_demand_scans/1/edit.
  2. Fill-in the form and click on Save and run scan, you should be redirected to /your/dast/pipeline (path mocked in the patch above).
  3. Go back to the form, fill it again and click on Save scan, you should be redirected to /your/scan/edit/page (also mocked in the patch).

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Related to #295242 (closed)

Edited by Paul Gascou-Vaillancourt

Merge request reports