A shared runner executes jobs from untrusted forks. What are the risks and mitigations?

AdvancedScenarioGitLab CI
Answer

Situation read → External code on shared infrastructure.

What I'd do →

  1. Run fork MR pipelines only after maintainer approval, and do not expose protected variables to them.
  2. Use ephemeral, isolated runners (Kubernetes pods or autoscaled VMs), no Docker socket binding, and no privileged mode.
  3. Restrict network egress from runners and avoid long-lived credentials on runner hosts.

Why → CI runners execute arbitrary code by design.

Interview tip → Mention "runner is the trust boundary".

All CI/CD questions Roadmap: GitLab CI/CD

More on GitLab CI