Update licenses validation

What does this MR do and why?

This MR updates the security policy schema to prevent the use of the licenses field together with licenses_type and match_on_inclusion_license. This change was discussed here and is also being added in the frontend.

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

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_2025-01-03_at_4.13.12_PM

How to set up and validate locally

  1. Create a new project
  2. Go to Secure > Policies
  3. Click in New policy
  4. Select Merge request approval policy
  5. Try to create a policy using licenses, license_types, and match_on_inclusion_license

Something like:

type: approval_policy
name: abcd
description: ''
enabled: true
rules:
  - type: license_finding
    match_on_inclusion_license: true
    license_types:
      - MIT License
    license_states:
      - newly_detected
    branches: []
    licenses:
      denied:
        - name: MIT License
actions:
  - type: require_approval
    approvals_required: 1
    role_approvers:
      - owner
  - type: send_bot_message
    enabled: true
approval_settings:
  block_branch_modification: true
  prevent_pushing_and_force_pushing: true
  prevent_approval_by_author: true
  prevent_approval_by_commit_author: true
  remove_approvals_with_new_commit: true
  require_password_to_approve: false
fallback_behavior:
  fail: closed
  1. Verify the policy is invalid
Edited by Marcos Rocha

Merge request reports

Loading