GitLab CI/CD Scan Execution Policy-as-Code Prompt
Enforce required security scans across many projects with GitLab Scan Execution Policies and Pipeline Execution Policies — so SAST, secret detection, and container scanning run on every pipeline regardless of what a project's own .gitlab-ci.yml says.
- Target user
- Security platform teams enforcing org-wide scan coverage
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior security platform engineer who has rolled out GitLab Security Policies (Scan Execution and Pipeline Execution policies) across a group so scans cannot be bypassed by editing a project's pipeline. I will provide: - The scans I must guarantee on every project (SAST, secret detection, container scanning, dependency scanning) - My GitLab tier, group structure, and whether a security policy project exists - How teams currently (fail to) include scans, and where coverage gaps are Your job: 1. **Why policies, not includes** — explain why a Scan Execution Policy enforced at the group level beats asking every project to `include:` a scan template, and how it survives a project deleting its scan jobs. 2. **Policy project setup** — outline linking a security policy project to the group and the `policy.yml` layout. 3. **Scan execution policy** — produce a `scan_execution_policy` in `.gitlab/security-policies/policy.yml` that runs the required scans on `branch_type: protected` and on default-branch pipelines, with the scan profiles set. 4. **Pipeline execution policy** — when scans alone are not enough, show a `pipeline_execution_policy` that injects a custom CI config and the `inject`/`override` strategy trade-offs. 5. **Scope & exemptions** — how to target subsets of projects and handle legitimate exceptions without disabling enforcement globally. 6. **Verification** — confirm enforced jobs appear in target pipelines and that a project cannot remove them. Output as: (a) the `policy.yml` with a scan execution policy, (b) a pipeline execution policy snippet, (c) a scope/exemption table, (d) a verification checklist. Test policy changes on a pilot subgroup; a misconfigured group policy injects jobs into every pipeline at once.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
GitLab CI/CD FIPS-Compliant Runner Hardening Prompt
Stand up and validate FIPS 140-compliant GitLab Runners and pipelines — FIPS images, crypto policy, verification, and avoiding silent non-compliant fallbacks.
-
GitLab Compliance Frameworks & Mandatory Pipeline Prompt
Design GitLab compliance frameworks — enforced pipeline configurations that run alongside project pipelines, audit-ready evidence collection.
-
GitLab SAST / DAST / Container Scanning Configuration Prompt
Configure GitLab's security scanning — SAST, DAST, container scanning, IaC scanning; tune for false positives; integrate into merge gates.
-
GitLab CI/CD Android Signed APK/AAB Build Pipeline Prompt
Build, test, and sign Android APK/AAB artifacts in GitLab CI — keystore secrecy, Gradle caching, SDK licenses, and Play Store upload without leaking signing keys.
More GitLab CI/CD prompts & error guides
Browse every GitLab CI/CD prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.