Skip to content

Configure ignoring default before and after_script for policies

What does this MR do and why?

This MR modifies behavior introduced in Ignore default before and after_script for Scan... (!159486 - merged) and allows this to be configured as a configuration option in the policy itself rather than enforcing behavior that potentially could be breaking change for customers.

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.

How to set up and validate locally

  1. Create new project
  2. Add gitlab-ci.yml file with default.before_script and default.after_script set to - exit 1
  3. Create new Policy (Secure -> Policies -> Create new -> Scan Execution Policy) and select secret_detection scan, in YAML-mode add scan_settings: { ignore_default_before_after_script: true } setting.
  4. Run pipeline in your project
  5. before_script and after_script should not interrupt execution of the policy
  6. Modify policy to have scan_settings: { ignore_default_before_after_script: false }
  7. Run pipeline in your project
  8. before_script and after_script should interrupt execution of the policy
  9. Modify policy to remove scan_settings
  10. Run pipeline in your project
  11. before_script and after_script should interrupt execution of the policy

Related to #472663 (closed)

Merge request reports

Loading