Interview Prep/DevSecOps/Pipeline Security Scanning

How do you harden self-hosted CI runners?

AdvancedScenarioPipeline Security Scanning
Answer

Situation read → A persistent runner shared between repos is a lateral-movement path: one bad job can leave malware or steal tokens for the next.

What I'd do →

  1. Use ephemeral runners (one job per VM or pod, destroyed afterwards), for example Actions Runner Controller on Kubernetes.
  2. Never attach self-hosted runners to public repos.
  3. Give each runner minimal cloud permissions through short-lived credentials and IMDSv2 with hop limit 1.
  4. Network egress allowlist; no access to production networks.
  5. Separate runner groups per trust level.
  6. Patch the base image regularly and log all job activity.

Why → Ephemeral runners remove persistence, which is the main attacker advantage.

Interview tip → Mention that docker.sock mounts equal root on the host.

All DevSecOps questions Roadmap: Security in the pipeline

More on Pipeline Security Scanning