Add warning for invalid scan execution policies

What does this MR do and why?

This MR adds warning for invalid policies

Scan execution policies with exceeding number of actions, from now on will have a warning

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.

Description After
Banner and error icon Screenshot 2024-09-03 at 00.26.40.png
Single violation Screenshot 2024-09-05 at 00.50.37.png
Stacked violations Screenshot 2024-09-05 at 00.50.46.png

How to set up and validate locally

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

  1. Create a project

  2. On the level left sidebar, select Security & Compliance and Policies

  3. Select New Policy

  4. Select Scan execution policy

  5. Switch to .yaml mode.

  6. Paste the following policy

    type: scan_execution_policy
    name: test
    description: ''
    enabled: true
    rules:
      - type: pipeline
        branches:
          - '*'
    actions:
      - scan: secret_detection
      - scan: secret_detection
      - scan: secret_detection
      - scan: secret_detection
      - scan: secret_detection
      - scan: secret_detection
      - scan: secret_detection
      - scan: secret_detection
      - scan: secret_detection
      - scan: secret_detection
      - scan: secret_detection
  7. Select Configure with a merge request

  8. Enable the feature flag: echo "Feature.enable(:scan_execution_policies_action_limit)" | rails c

  9. Go to policy list, make sure you see the banner and error icon

Related to #472229 (closed) #475021 (closed)

Edited by Artur Fedorov

Merge request reports

Loading