Skip to content

Fix license state dropdown

Alexander Turinske requested to merge 371511-fix-license-state-dropdown into master

What does this MR do and why?

Describe in detail what your merge request does and why.

Fix license state dropdown

  • update field value for parsing license states based on schema

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
rules_-_b rules_-_a

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Upload a GitLab Ultimate license
  2. Turn on the license_scanning_policies feature flag (echo "Feature.enable(:license_scanning_policies)" | rails c
  3. Navigate to http://gdk.test:3443/flightjs/Flight/-/security/policies/new and create the below policy and save it
type: scan_result_policy
name: Require approvers for license policy changes
description: ''
enabled: true
actions:
- type: require_approval
  approvals_required: 1
  user_approvers_ids:
  - 1688069
rules:
- type: license_finding
  branches: []
  match_on_inclusion: true
  license_types:
  - MIT License
  license_states:
  - detected
  1. Navigate to http://gdk.test:3443/flightjs/Flight/-/security/policies, select the policy, edit it
  2. Apply the below patch (which will be applied with Update from_yaml parser to include new fields (!111100 - merged), but this bug does not depend on this MR for except that both MRs fix different bugs on the same page)
diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result_policy/lib/from_yaml.js b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result_policy/lib/from_yaml.js
index 8a1a1245c32e..7b03d2dbb2bf 100644
--- a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result_policy/lib/from_yaml.js
+++ b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_result_policy/lib/from_yaml.js
@@ -11,9 +11,12 @@ export const fromYaml = (manifest) => {
   const rulesKeys = [
     'type',
     'branches',
+    'license_states',
+    'license_types',
+    'match_on_inclusion',
     'scanners',
-    'vulnerabilities_allowed',
     'severity_levels',
+    'vulnerabilities_allowed',
     'vulnerability_states',
   ];
   const actionsKeys = [
  1. Verify the dropdown

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #371511 (closed)

Edited by Alexander Turinske

Merge request reports