Configure ignoring default before and after_script for policies
requested to merge 472663-ignore-default-before-after-script-in-sep-as-configuration-option into master
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
- Create new project
- Add
gitlab-ci.yml
file withdefault.before_script
anddefault.after_script
set to- exit 1
- Create new Policy (Secure -> Policies -> Create new -> Scan Execution Policy) and select
secret_detection
scan, in YAML-mode addscan_settings: { ignore_default_before_after_script: true }
setting. - Run pipeline in your project
-
before_script
andafter_script
should not interrupt execution of the policy - Modify policy to have
scan_settings: { ignore_default_before_after_script: false }
- Run pipeline in your project
-
before_script
andafter_script
should interrupt execution of the policy - Modify policy to remove
scan_settings
- Run pipeline in your project
-
before_script
andafter_script
should interrupt execution of the policy
Related to #472663 (closed)