Skip to content

Add drawer for vulnerability management policy

What does this MR do and why?

Related #465751 (closed)

Add drawer for vulnerability management policy

This adds a specific drawer component for the vulnerability management policy type which appears when clicking a policy of that type in the policies list. It will show all basic info like name, status, description, and scope.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshot_2024-08-09_at_17.50.13

Screenshot_2024-08-09_at_17.50.23

How to set up and validate locally

Because the policy list cannot fetch vulnerability policy types and we can't persist those yet (backend work coming later), we need to mock a policy of the vulnerability management type.

Apply the following patch pbpaste | git apply to do so:

diff --git a/ee/app/assets/javascripts/security_orchestration/components/policies/list_component.vue b/ee/app/assets/javascripts/security_orchestration/components/policies/list_component.vue
index 854545f61352..2d225faa5fc5 100644
--- a/ee/app/assets/javascripts/security_orchestration/components/policies/list_component.vue
+++ b/ee/app/assets/javascripts/security_orchestration/components/policies/list_component.vue
@@ -104,6 +104,57 @@ export default {
         getPoliciesWithType(this.policiesByType[type], POLICY_TYPE_FILTER_OPTIONS[type].text),
       );
 
+      policies[0] = {
+        __typename: 'VulnerabilityManagementPolicy',
+        name: 'Resolve no longer detected',
+        yaml: '---\nname: Resolve no longer detected\ndescription: Auto-resolve all no longer detected vulnerabilities.\nenabled: true\nactions:\n- type: auto_resolve\nrules:\n- type: no_longer_detected\n  severity_levels: []\n  scanners: []',
+        editPath:
+          'https://gdk.test:3443/gitlab-org/security-reports/-/security/policies/scan+exec+1/edit?type=scan_execution_policy',
+        enabled: true,
+        policyScope: {
+          __typename: 'PolicyScope',
+          complianceFrameworks: {
+            __typename: 'ComplianceFrameworkConnection',
+            nodes: [],
+            pageInfo: {
+              __typename: 'PageInfo',
+              hasNextPage: false,
+              hasPreviousPage: false,
+              startCursor: null,
+              endCursor: null,
+            },
+          },
+          excludingProjects: {
+            __typename: 'ProjectConnection',
+            nodes: [],
+            pageInfo: {
+              __typename: 'PageInfo',
+              hasNextPage: false,
+              hasPreviousPage: false,
+              startCursor: null,
+              endCursor: null,
+            },
+          },
+          includingProjects: {
+            __typename: 'ProjectConnection',
+            nodes: [],
+            pageInfo: {
+              __typename: 'PageInfo',
+              hasNextPage: false,
+              hasPreviousPage: false,
+              startCursor: null,
+              endCursor: null,
+            },
+          },
+        },
+        source: {
+          __typename: 'ProjectSecurityPolicySource',
+          project: { __typename: 'Project', fullPath: 'gitlab-org/security-reports' },
+        },
+        updatedAt: '2024-07-03T12:50:07+00:00',
+        policyType: 'Vulnerability management',
+      };
+
       return policies.flat();
     },
     hasSelectedPolicy() {
  1. enable feature flag vulnerability_management_policy_type
  2. go to a project
  3. go to Secure > Policies
  4. click on the mocked vulnerability management policy
  5. validate that the drawer opens and shows the name, description, scope, and status
  6. validate that clicking the YAML tab shows the yaml of the policy
Edited by Lorenz van Herwaarden

Merge request reports

Loading