Build a Secure GitLab CI Delivery Pipeline

8 steps · about 2 h 42 min · Intermediate

  1. Define an explicit pipeline graph (doc, GitLab Docs, 24 min)

    Stages, needs, rules and includes determine what runs and which untrusted inputs can reach it.

  2. Map pipeline threat boundaries (doc, GitLab Docs, 20 min)

    Merge requests, forks, variables and included configuration create distinct trust levels.

  3. Constrain runner scope and tags (doc, GitLab Docs, 20 min)

    Runner ownership and job selection decide where privileged code can execute.

  4. Keep secrets out of ordinary variables (doc, GitLab Docs, 18 min)

    External secret providers and short-lived identity reduce long-lived credentials exposed to jobs.

  5. Limit job-token reach (doc, GitLab Docs, 18 min)

    Job tokens should access only required projects and APIs for the duration of the job.

  6. Protect production deployment authority (doc, GitLab Docs, 18 min)

    Protected environments restrict who can trigger a sensitive deployment independently of repository write access.

  7. Set artifact contents and retention deliberately (doc, GitLab Docs, 16 min)

    Artifacts can carry build outputs or secrets across stages and must not persist by accident.

  8. Exercise an approved production deployment (tutorial, GitLab Docs, 28 min)

    A final run should show immutable inputs, an independent approval, deployment evidence and a usable rollback reference.