一键导入
gitlab-security-policies
Working with GitLab security policies — reading, writing, gnerating security policies including approval policies, scan execution policies
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Working with GitLab security policies — reading, writing, gnerating security policies including approval policies, scan execution policies
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | gitlab-security-policies |
| description | Working with GitLab security policies — reading, writing, gnerating security policies including approval policies, scan execution policies |
| version | 1.0.0 |
| license | MIT |
| compatibility | opencode |
| metadata | {"audience":"developers","workflow":"gitlab-security"} |
Everything needed to read, write, and manage GitLab security policies on a local GDK instance or GitLab.com.
ee/app/validators/json_schemas/security_orchestration_policy.json is the source of truth for policy.yml structure and validation rules
Security policies live in .gitlab/security-policies/policy.yml inside a policy project (often the project itself). Three policy types exist:
approval_policy Referencetype | Triggers on |
|---|---|
scan_finding | Scanner finds vulnerabilities |
license_finding | License scan detects denied/unknown licenses |
any_merge_request | Any MR (optionally filter by commits: unsigned) |
scan_finding — valid scanners valuessast, secret_detection, dependency_scanning, container_scanning, coverage_fuzzing, dast
vulnerability_statesnew_needs_triage, detected, confirmed, resolved, dismissed
branch_typeprotected, default, all
fallback_behavior.failclosed — block MR if scan didn't run (strict)open — allow MR if scan didn't run (lenient)scan_finding exampleapproval_policy:
- name: MR - SAST
description: Require approval when SAST finds new vulnerabilities
enabled: true
rules:
- type: scan_finding
scanners:
- sast
vulnerabilities_allowed: 0
severity_levels: [] # empty = all severities
vulnerability_states:
- new_needs_triage
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: closed
license_finding example - name: MR - Copyleft Licenses
description: Block MRs introducing copyleft licenses
enabled: true
rules:
- type: license_finding
branch_type: protected
license_states:
- newly_detected
- detected
match_on_inclusion_license: true
licenses:
denied:
- name: GNU General Public License v2.0
- name: GNU General Public License v3.0
- name: GNU Lesser General Public License v2.1
- name: GNU Lesser General Public License v3.0
- name: GNU Affero General Public License v3.0
- name: Mozilla Public License 2.0
- name: Server Side Public License
actions:
- type: require_approval
approvals_required: 2
role_approvers:
- maintainer
- owner
- type: send_bot_message
enabled: true
approval_settings:
block_branch_modification: true
prevent_pushing_and_force_pushing: true
prevent_approval_by_author: true
prevent_approval_by_commit_author: true
remove_approvals_with_new_commit: true
require_password_to_approve: false
fallback_behavior:
fail: closed
any_merge_request (unsigned commits) example - name: MR - Unsigned Commits
description: Require approval for MRs with unsigned commits
enabled: true
rules:
- type: any_merge_request
commits: unsigned
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: true
prevent_pushing_and_force_pushing: true
prevent_approval_by_author: true
prevent_approval_by_commit_author: true
remove_approvals_with_new_commit: true
require_password_to_approve: false
fallback_behavior:
fail: open
scan_execution_policy (SEP) Referencetype | Key fields |
|---|---|
pipeline | branch_type or branches, optional pipeline_sources |
schedule | branch_type or branches or agents, cadence (cron), optional timezone |
branch_type values: default, protected, all, target_default, target_protected
pipeline_sources.including values: push, merge_request_event, schedule, web, api, trigger
scan valuessast, secret_detection, dependency_scanning, container_scanning, dast, coverage_fuzzing, api_fuzzing
sast_iac= SAST for Infrastructure as Code (Terraform, Helm, CloudFormation, Kubernetes manifests, Ansible). Valid scan value but only useful when IaC files are present.
| Field | Values |
|---|---|
scan | scanner name (required) |
template | default or latest |
variables | key/value CI variables |
tags | runner tag array |
site_profile | DAST site profile name |
scanner_profile | DAST scanner profile name |
skip_ciskip_ci.allowed: true — allows users to skip the policy-enforced scan with [skip ci].
scan_execution_policy:
- name: ''
description: ''
enabled: true
rules:
- type: pipeline
branch_type: default
- type: pipeline
branch_type: target_default
pipeline_sources:
including:
- merge_request_event
actions:
- scan: sast
variables:
SECURE_ENABLE_LOCAL_CONFIGURATION: 'false'
template: latest
- scan: dependency_scanning
template: latest
- scan: container_scanning
template: latest
- scan: secret_detection
variables:
SECURE_ENABLE_LOCAL_CONFIGURATION: 'false'
template: latest
skip_ci:
allowed: true
- name: Nightly full scan
description: Run all scanners nightly on default branch
enabled: true
rules:
- type: schedule
cadence: '0 2 * * *'
branch_type: default
actions:
- scan: sast
- scan: secret_detection
- scan: dependency_scanning
- scan: container_scanning
pipeline_execution_policy (PEP) ReferenceInjects arbitrary CI config into every pipeline. Use SEP instead when you only need to enforce security scanners.
pipeline_execution_policy:
- name: Enforce CI templates
description: ''
enabled: true
pipeline_config_strategy: inject_policy
content:
include:
- template: Jobs/SAST.gitlab-ci.yml
- template: Jobs/Secret-Detection.gitlab-ci.yml
.bundle/scripts/projects/policies/)| File | Contents |
|---|---|
pep.yml | Pipeline execution policy — inject a CI file from another project |
pesp_daily.yml | Pipeline execution schedule policy — daily scheduled pipeline |
sep.yml | Scan execution policy (currently empty — use examples above) |
unsigned_commit_on_develop_branch.yml | any_merge_request approval policy for unsigned commits |
restricted_license_on_feature_branch.yml | license_finding approval policy for feature branches |
Writing, running, and debugging RSpec specs in the GitLab monorepo — commands, patterns, undercoverage, system specs, and GitLab-specific conventions
Fast file name search with fd — correct pattern modes, type filters, ignore behavior, exec patterns, and common misuse to avoid
Extract and analyze all failures from the most recent GitLab pipeline
GitLab workflow automation using glab CLI
Generate GitLab MR descriptions matching the project's writing conventions — includes database queries, background context, series references, and validation steps
Pre-submission self-review checklist — catches what reviewers historically flag on your MRs before they get a chance to