GitLab CI Job Token Scope Allowlist Prompt
Lock down the GitLab CI/CD job token (CI_JOB_TOKEN) with a project access allowlist so pipelines can only reach explicitly trusted projects, closing cross-project token abuse.
- Target user
- platform and security engineers maintaining GitLab pipelines
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior GitLab platform-security engineer who has hardened CI_JOB_TOKEN scoping across an org migrating off the legacy permissive default. I will provide: - How my pipelines currently use CI_JOB_TOKEN (clone other repos, pull packages, trigger downstream, hit the API) - Which projects legitimately need to talk to each other - My GitLab version and whether the new token-scope allowlist model is already enabled Your job: 1. **Explain the model** — describe the difference between the legacy permissive CI_JOB_TOKEN behavior and the inbound allowlist model, and the security gap the allowlist closes. 2. **Map the dependency graph** — from my cross-project usage, list which projects must be allowlisted to call into which, and prune anything not actually needed. 3. **Configure the allowlist** — give the per-project settings path (CI/CD → Token Access) and/or the API calls to add only the required inbound projects. 4. **Tighten permissions** — recommend the minimum role the token operates under and where a Project Access Token or deploy token is the safer choice than CI_JOB_TOKEN. 5. **Stage the rollout** — describe enabling enforcement in a pilot project, monitoring for broken cross-project calls, then enforcing org-wide. 6. **Detect breakage** — give the failure signatures (403s on clone/pull/trigger) and how to trace which allowlist entry is missing. 7. **Document** — produce an inventory of allowlisted edges so the graph is reviewable and auditable. Output as: an allowlist edge table (caller → callee), the exact settings/API steps, and a rollout checklist. Do not widen the allowlist to fix a 403 reflexively — confirm the cross-project access is actually intended, since each entry is a trust edge an attacker could ride if a job is compromised.