Skip to content

Display new fields added to DAST site profiles

Dheeraj Joshi requested to merge djadmin-site-profile-auth-integrate into master

What does this MR do?

Implements #271226 (closed)

  • Add additional fields to "DAST site profiles" selector
  • Adjust spacing for summary cell
  • Update GraphQL query
  • Put everything behind a new feature flag

Screenshots (strongly suggested)

Profile Selector

Without Auth enabled With Auth enabled
image image

Full Page

image

How to test this?

  1. Enable the feature flag:
echo "Feature.enable(:security_dast_site_profiles_additional_fields)" | rails c
  1. Since the backend is currently not ready to support these new fields, apply the following patch to mock the values for them.
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..c4e6c092ebb 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,21 @@ import createDefaultClient from '~/lib/graphql';
 
 Vue.use(VueApollo);
 
+const resolvers = {
+  DastSiteProfile: {
+    auth: () => ({
+      enabled: true,
+      url: 'http://authdomain.com',
+      usernameField: 'username',
+      passwordField: 'password',
+      username: 'DenverCoder9',
+      __typename: 'DastSiteProfileAuth',
+    }),
+    excludedUrls: () => 'http://authdomain.com/excluded',
+    requestHeaders: () => 'MY_HEADER=something',
+  },
+};
+
 export default new VueApollo({
-  defaultClient: createDefaultClient(),
+  defaultClient: createDefaultClient(resolvers),
 });
diff --git a/ee/app/assets/javascripts/security_configuration/dast_profiles/graphql/dast_site_profiles_extended.query.graphql b/ee/app/assets/javascripts/security_configuration/dast_profiles/graphql/dast_site_profiles_extended.query.graphql
index a61fc2fd79d..15d9569c75e 100644
--- a/ee/app/assets/javascripts/security_configuration/dast_profiles/graphql/dast_site_profiles_extended.query.graphql
+++ b/ee/app/assets/javascripts/security_configuration/dast_profiles/graphql/dast_site_profiles_extended.query.graphql
@@ -16,15 +16,15 @@ query DastSiteProfiles($fullPath: ID!, $after: String, $before: String, $first:
           targetUrl
           editPath
           validationStatus
-          auth {
+          auth @client {
             enabled
             url
             usernameField
             passwordField
             username
           }
-          excludedUrls
-          requestHeaders
+          excludedUrls @client
+          requestHeaders @client
         }
       }
     }

git apply | pbpaste

  1. Navigate to the On-demand scans form in your GDK: /:namespace/:project/-/on_demand_scans/

  2. Select a site profile

Does this MR meet the acceptance criteria?

Conformity

Edited by Dheeraj Joshi

Merge request reports