List invalid policies
What does this MR do and why?
This MR updates the Policies API to return the policies with deprecated properties. Listing invalid policies will help users update them.
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
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Policy with deprecated properties are visible in the policy list
How to set up and validate locally
If you have a project with a policy using match_on_inclusion
or newly_detected
- Go the Secure > Policies
- The invalid policy should be on the list
If you don't have a project with a invalid policy
- Create a new project
- Go to Secure > Policies
- Click on New policy
- Select Merge request approval policy
- Change to .yaml mode
- Copy the yaml below:
type: approval_policy
name: 'policy with deprecated properties'
description: ''
enabled: true
actions:
- type: require_approval
approvals_required: 1
role_approvers:
- developer
rules:
- type: license_finding
branches: []
match_on_inclusion_license: true
license_types:
- Mozilla Public License 1.0
license_states:
- detected
-
Click on Configure with a merge request
-
Merge the new MR to add the policy
-
After merging the policy, in the security policy project, go to Repository
-
Click on gitlab/security-policies
-
click on policy.yml
-
Edit the policy to
---
approval_policy:
- name: policy with deprecated properties
description: ''
enabled: true
actions:
- type: require_approval
approvals_required: 1
role_approvers:
- developer
rules:
- type: license_finding
branches: []
match_on_inclusion: true
license_types:
- Mozilla Public License 1.0
license_states:
- newly_detected
- Create a merge request and merge the policy
- Go back to the project created on step 1
- Go to Secure > Policies and check if the invalid policy is on the list