Default scan_execution_policies_action_limit setting to 0
What does this MR do and why?
We have previously introduced the scan_execution_policies_action_limit application setting with a default value of 10. This setting lets admins configure the maximum number of actions per scan execution policy. The effect of this setting is gated by a feature flag, since enabling the limit is a breaking change.
We were planning to enable the feature flag for %18.0 but have decided to change our approach so that the limit of 10 actions only takes effect on gitlab.com. To accomplish this, this MR:
- changes the default value of the
scan_execution_policies_action_limitapplication setting to 0 - updates the backend action limiting so that actions don't get limited when the setting is 0
- removes the feature flags since the application setting is now used to opt-in to the new code branch
- adds a database migration for resetting the setting value in
application_settings.security_policies - updates the frontend policy overview
- hard-codes the upcoming action limit of 10
- makes the banner only show if the hard-coded limit of 10 is exceeded
- marks policies only as invalid in the UI if the setting is not 0
Once %18.0 ships, we will update the application setting through a Change Request.
References
- Implementation Issue: #535605 (closed)
- Discussion: &14460 (comment 2442540846)
- Deprecation Issue: #510897 (closed)
- Previous Implementation: #472214 (closed)
How to set up and validate locally
-
(Optional) If you have set the application setting before, reset it to 0 by navigating to
Admin > Settings > Security and Compliance > Security policies > Maximum number of actions per scan execution policy -
Create a new project, navigate to
Secure > Policiesand create the following scan execution policy:
scan_execution_policy:
- name: Policy A
enabled: true
rules:
- type: schedule
branch_type: default
cadence: 0 0 * * *
actions:
- scan: secret_detection
- scan: container_scanning
-
Navigate back to
Secure > Policiesand verify no banner is displayed and the policy is not marked as invalid -
Create the following scan execution policy:
scan_execution_policy:
- name: Policy B
enabled: true
rules:
- type: schedule
branch_type: default
cadence: 0 0 * * *
actions: # 11 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
-
Navigate back to
Secure > Policiesand verify theMaximum action limit for scan execution policies will be enabled in 18.0banner is displayed but no policy is marked as invalid -
Set the application setting to 10:
curl -sX PUT -H "PRIVATE-TOKEN: $GITLAB_TOKEN" "http://gdk.test:3000/api/v4/application/settings?scan_execution_policies_action_limit=10"
- Navigate back to
Secure > Policiesand verify onlyPolicy Bis marked as invalid
Screenshots
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #535605 (closed)