Draft: Update MR widget to show bypassed policies
What does this MR do and why?
Update MR widget to show bypassed policies
- explicitly say policies are bypassed
Changelog: added
EE: true
References
Screenshots or screen recordings
| Scenario | After |
|---|---|
| Bypassed policy |
|
How to set up and validate locally
- Upload a GitLab Ultimate license
- Enable the
security_policy_approval_warn_modefeature flag in http://gdk.test:3443/rails/features - Create a ruby project (use ruby template) with SAST enabled (easiest scanner to enable)
- Install and run gitlab runners in your gdk (instructions)
- Navigate to the new project => Secure => Policies => New policy => Merge request approval policy
- Create a policy that is enforced
Enforce policy
approval_policy:
- name: Prevent Critical Vulnerabilities
description: This is to prevent Critical/High Vulnerabilities from getting merged
enabled: true
actions:
- type: require_approval
approvals_required: 1
role_approvers:
- maintainer
- developer
- owner
rules:
- type: scan_finding
scanners: []
vulnerabilities_allowed: 0
severity_levels: []
vulnerability_states: []
branch_type: protected
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: open
- Create a policy that is not enforced (warn policy)
Warn policy
approval_policy:
- name: Warn - Prevent SAST vulnerabilities
description: Security Scan
enabled: true
enforcement_type: "warn"
rules:
- type: scan_finding
scanners:
- sast
vulnerabilities_allowed: 0
severity_levels: []
vulnerability_states: []
branch_type: protected
actions:
- type: require_approval
approvals_required: 1
role_approvers:
- developer
- maintainer
- owner
- 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: false
require_password_to_approve: false
fallback_behavior:
fail: open
- Create an MR in the new project with vulnerable code
vulnerable_code.rb
input = gets.chomp
eval("puts \#{input}")
job = params[:job]
eval(job)
- Verify the MR widget shows that policies are being violated
- Verify the dismiss button appears
- Verify clicking the
Bypassbutton brings up a modal - Verify the user can select the warn policy
- Click the
Bypassbutton - Verify the modal is closed
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 #561650 (closed)
Edited by Alexander Turinske
