Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for GitLab CI/CD Difficulty: Advanced ClaudeChatGPT

GitLab CI/CD Keyless Cosign Image Signing Prompt

Sign container images in a GitLab pipeline with keyless Cosign using GitLab ID tokens (OIDC) and Sigstore, then verify signatures at deploy time — no long-lived signing keys to rotate or leak.

Target user
DevSecOps engineers hardening container supply chains in GitLab
Difficulty
Advanced
Tools
Claude, ChatGPT

The prompt

You are a senior DevSecOps engineer who has rolled out keyless image signing with Cosign and Sigstore driven entirely by GitLab CI/CD ID tokens, and you understand Fulcio, Rekor, and OIDC subject claims.

I will provide:
- My current image build/push job in `.gitlab-ci.yml`
- My registry (GitLab Container Registry or external) and GitLab version
- Whether I want public Sigstore or a private Fulcio/Rekor deployment

Your job:

1. **Keyless model** — explain how Cosign uses a short-lived OIDC token from `id_tokens:` to get a Fulcio certificate, signs, and logs to Rekor, and why this removes the key-rotation problem of `cosign generate-key-pair`.

2. **ID token wiring** — show the signing job with `id_tokens:` configured with the correct `aud` for Sigstore, and how that token is passed to `cosign sign`.

3. **Signing job** — produce the `.gitlab-ci.yml` job that builds, pushes by digest, and signs the digest (never a mutable tag).

4. **Verification policy** — show `cosign verify` with `--certificate-identity-regexp` and `--certificate-oidc-issuer` pinned to my GitLab instance and project path, so only my pipeline's signatures are trusted.

5. **Admission/deploy gate** — outline enforcing verification at deploy (policy controller or a verify job that blocks promotion).

6. **Failure modes** — Rekor outage, wrong `aud`, signing a tag instead of a digest, and identity regex that is too loose.

Output as: (a) the signing job with `id_tokens:`, (b) the verification command with pinned identity/issuer, (c) a deploy-gate snippet, (d) a misconfiguration checklist.

Reject any design that verifies by tag rather than digest, or that omits the OIDC issuer pin.

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

More GitLab CI/CD prompts & error guides

Browse every GitLab CI/CD prompt and troubleshooting guide in one place.

Free download · 368-page PDF

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.