İçeriğe Atla
Mustafa Erbay
Technology · 11 min read · görüntülenme Türkçe oku
100%

Self-Hosted CI Runner Security: Isolation, OIDC and Secrets

A practical model that lowers supply-chain risk on self-hosted CI runners with isolation, network boundaries and OIDC-based short-lived authorization.

Self-Hosted CI Runner Security: Isolation, OIDC and Secrets — cover image

A self-hosted CI runner gives you speed and control: faster builds, private network reach, cost optimization. But it is also one of the easiest execution surfaces to abuse. Because in practice a CI job inherits the right to “run code on your behalf.”

For teams running self-hosted runners on systems like GitHub Actions, this post pulls together the three axes I’ve seen make the biggest difference in the field:

  1. Isolation (a runner that is “single-use” and bounded)
  2. OIDC (short-lived access in place of static secrets)
  3. Secret discipline (separating deploy authority)

1) Threat model: What can go wrong on a runner?

A practical threat model for a self-hosted runner:

  • Running arbitrary commands via a pull request
  • Network reconnaissance from the runner (internal scan)
  • Carrying a backdoor through artifacts or cache
  • Leaking deploy credentials
  • Long-term takeover of the runner host (persistence)

2) Primary control: Design the runner as ephemeral, not persistent

The most robust model is the ephemeral runner.

Practical options:

  • Spin up a fresh VM/instance per job, destroy it when the job finishes
  • If you use container runners: “no privileged,” no host mounts, no shared nodes
  • Keep the cache “per repo” and bounded; cut down cross-repo sharing

The goal: even if an attacker lands on the runner, they can’t establish persistence.

3) Network boundary: The runner’s egress should be “default deny”

In most organizations, a self-hosted runner reaches:

  • artifact registry
  • package repo
  • container registry
  • deploy API (cloud, k8s, etc.)

The risk: a runner that “can reach anywhere internal” is a golden ticket for lateral movement.

Minimum practice:

  • Place the runner in its own subnet
  • Egress allowlist: only the required domains/IPs/ports
  • Alert on “unexpected egress” using DNS log + proxy log

4) Secret strategy: Separate build from deploy

The fastest win when designing a runner securely:

  • Build runner: compiles/tests code, no deploy authority
  • Deploy runner: runs only on main/tag and after approval; tighter and observed

If the same runner handles both PR builds and prod deploys, one day a PR will carry your prod keys out. It usually goes unnoticed; until it doesn’t.

5) OIDC: Get static keys out of CI

If static cloud keys (access key/secret) sit in the CI secret store:

  • they leak
  • they get forgotten
  • they don’t get rotated

The OIDC approach:

  1. The CI job obtains a short-lived identity token
  2. On the cloud side, that identity is authorized “only for this repo/branch/job”
  3. When the token expires, access ends

Operational gain: less rotation toil, stronger audit trail, tighter authority.

6) Minimum viable runner security checklist

  • Ephemeral runner, or a “clean image + frequent reset” pattern, is in place
  • PR jobs do not receive deploy authority
  • Deploy jobs run on a protected branch/tag with approval
  • Runner egress allowlist (default deny)
  • Short-lived authorization via OIDC
  • Token permissions kept minimum (repo token permissions narrow)
  • Artifact signing / checksum verification
  • Runner log + network log + audit log correlation

Self-hosted runner security isn’t a single setting; it’s the combination of isolation + separation of authority + short-lived identity. When the trio comes together, CI stops being a “hidden admin machine” inside the company and becomes a manageable automation surface.

Paylaş:

Bu yazı faydalı oldu mu?

Yükleniyor...

Bu yazı nasıldı?

ME

Mustafa Erbay

Sistem Mimarisi · Network Uzmanı · Altyapı, Güvenlik ve Yazılım

2006'dan bu yana sistem mimarisi, network, sunucu altyapıları, büyük yapıların kurulumu, yazılım ve sistem güvenliği ekseninde çalışıyorum. Bu blogda sahada karşılığı olan teknik deneyimlerimi paylaşıyorum.

Kişisel Notlar

Bu notlar sadece sizde saklanır. Tarayıcınızda yerel olarak tutulur.

Hazır 0 karakter

Comments

Server-side AI Moderation

Comments are AI-moderated server-side and stored permanently.

?
0/2000

Server-side AI moderation

✉️ Free · No spam · Unsubscribe anytime

Curated digest, hand-picked by me — not the AI

Once a week: the most important post of the week, behind-the-scenes notes, and a "what I actually used this week" section. Less noise, more signal.

  • 📌
    Best of the week Single most-worth-reading post
  • 🔧
    Toolbox notes Real tools I used this week
  • 🧠
    Behind-the-scenes Notes that don't make it to blog

We don't spam. Unsubscribe anytime. · Tracked only by Umami (self-hosted, no Google).

Your Reading Stats

0

Posts Read

0m

Reading Time

0

Day Streak

-

Favorite Category

Related Posts