Draft: POC security policy integration with security attributes
What does this MR do and why?
POC security policy integration with security attributes
References
Related to: #589342 (closed)
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
- Create a new project
- Add a .gitlab-ci.yml file with the content:
include:
- template: Jobs/SAST.gitlab-ci.yml
- Go to Secure > Security Configuration
- Select Security attributes
- Click on Edit project security attributes
- Select
Mission Critical - Go to Secure > Policies
- Click on New policy
- Select Merge request approval policy
- Create a policy to block new vulnerabilities on
Mission Criticalprojects - Get the
security_attributeid
category = Security::Category.where(template_type: "business_impact")
Security::Attribute.where(security_category: category).where(name: "Mission Critical").first
- Create a policy like
approval_policy:
- name: Test
description: ''
enabled: true
rules:
- type: scan_finding
branches: []
vulnerabilities_allowed: 0
severity_levels: []
vulnerability_states: []
scanners: []
policy_scope:
business_impact:
including:
- id: 1
actions:
- type: require_approval
approvals_required: <security_attribute_id>
role_approvers:
- developer
- Click on Create new project with the new policy
- Merge the MR to add the policy
- Go back to the project created in step 1
- Create a MR adding the file
vuln.rbwith the content
class RunScript
def run_script
system("cat #{params[:path]}")
end
end
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.