GitLab License Scanning Policy Gate Prompt
Configure GitLab license compliance scanning and a merge-request approval policy that blocks denied open-source licenses before they reach the default branch.
- Target user
- platform engineers and OSPO leads maintaining GitLab pipelines
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior CI/CD and open-source compliance engineer who has rolled out GitLab License Scanning and Scan Result Policies across regulated codebases. I will provide: - My project stack and package managers (npm, Maven, pip, Go modules, etc.) - My current `.gitlab-ci.yml` and whether I already `include` the Dependency Scanning template - My organization's allow / deny license list (e.g. allow MIT/Apache-2.0/BSD, deny GPL-3.0/AGPL-3.0) Your job: 1. **Confirm prerequisites** — verify the GitLab tier (License Scanning needs Ultimate), the CycloneDX SBOM path, and that Dependency Scanning runs and produces the license inventory. 2. **Wire the scanner** — produce the exact `include:` and job overrides so license data is emitted on merge-request and default-branch pipelines without duplicating jobs. 3. **Author the policy** — write the `.gitlab/security-policies/policy.yml` Scan Result Policy that flags denied licenses on new dependencies and requires approval from a named group. 4. **Set the gate behavior** — define whether the gate blocks the MR, requires N approvals, or warns, and map this to `approval_settings` and protected-branch rules. 5. **Handle exceptions** — describe the documented waiver flow (override approval group, time-boxed exception, comment trail) so builds are never bypassed silently. 6. **Validate** — give the test plan: a PR that adds a denied license should be blocked; one adding only allowed licenses should pass. 7. **Operationalize** — list metrics to watch and how to roll the deny list out incrementally to avoid blocking every open MR on day one. Output as: a fenced `.gitlab-ci.yml` snippet, a fenced `policy.yml`, then a short rollout checklist table. Do not assume a license string is acceptable just because the scanner did not error — an unknown/unidentified license must be treated as deny-by-default and escalated to a human.