Merge Request Approval Policy on Secret Detection blocks even when no secret is detected
Summary
The Merge Request Approval Policy on Secret Detection blocks Merges even if no secret is detected.
Steps to reproduce
- Create an empty group
- Add a second user (Developer+ role) to your group (if you wanna be autonomous, create a user with a "plus addressing" on your gitlab.com email address)
- Create a MR Approval Policy
- Use the following YAML, with your own user ID and the user ID from the second developer from your project
type: approval_policy
name: Test MRAP
description: ''
enabled: true
policy_scope:
projects:
excluding: []
rules:
- type: scan_finding
scanners:
- secret_detection
vulnerabilities_allowed: 0
severity_levels: []
vulnerability_states: []
branch_type: protected
actions:
- type: require_approval
approvals_required: 1
user_approvers_ids:
- 14509426
- 10994493
- type: send_bot_message
enabled: true
approval_settings:
block_branch_modification: false
prevent_pushing_and_force_pushing: false
prevent_approval_by_author: false
prevent_approval_by_commit_author: false
remove_approvals_with_new_commit: true
require_password_to_approve: false
fallback_behavior:
fail: closed
- Merge your policy
- Create another policy
- Can be anything. Say a Scan Execution Policy to detect Secrets for example.
- Try to merge.
- The MR is blocked, requiring an approval while: 1. there is no secret leak, so you shouldn't be blocked 2. you should be able to approve your own MR, according to:
prevent_approval_by_author: false
prevent_approval_by_commit_author: false
Example Project
gl-demo-ultimate-odupre/shared-tests/tanuki-racing-sd/tanuki-racing-sd-security-policy-project!3
What is the current bug behavior?
The MR is blocked when it shouldn't You cannot auto-approve your MR when you should
What is the expected correct behavior?
No blocker (and the ability to auto-approve your own MR/commits).
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com
Possible fixes
- Override the default behavior for newly generated SPPs to disallow authors to also approve their own merge requests. The project setting may still be applied when/as needed.
- Ensure "Why can't I approve" option is appearing / working with security policies.
Edited by Grant Hickman


