SiegeSoft All articles
Gaming & Security

Build Runners Aren't Cattle: The Credential Debt Piling Up in Self-Hosted CI

SiegeSoft
Build Runners Aren't Cattle: The Credential Debt Piling Up in Self-Hosted CI

Photo by Photo by Valentin Lacoste on Unsplash on Unsplash

The premise of self-hosted CI is that the runner is interchangeable. A job lands, the machine builds, the machine is torn down. Elastic capacity, no drift, no pets. That is the design intent. In practice, a surprising number of runners are closer to long-lived workstations with a build agent bolted on — machines that have been in service for eighteen months, carry a home directory full of half-cleaned workspaces, and hold credentials that were granted for a single job and never revoked.

The reason is not negligence. It is that CI infrastructure is invisible in the way that plumbing is invisible. It works, it is not customer-facing, and it sits between two things that do get attention: the source code and the shipped product. Which makes it an excellent place to persist.

Disposable in Theory Only

Ask a simple question about any runner fleet: if this machine were compromised right now, what would the attacker hold?

In a properly ephemeral fleet, the answer is a short-lived token scoped to a single job, valid for minutes, and useless once the job ends. In many real fleets, the answer includes a deploy key for the release repository, a long-lived cloud access key, package registry credentials, an SSH key with access to an artifact host, a code-signing certificate, and a local Docker daemon socket. Some of those were added years ago to solve a specific problem and never revisited.

A runner that caches dependencies between jobs is genuinely faster. It is also a persistence mechanism. A poisoned Maven or NuGet cache, a modified build tool in a shared toolchain directory, or a tampered artifact in a workspace that was never wiped will be picked up by the next ten jobs before anyone notices.

What a Runner Remembers

Inventory is the unglamorous first step, and it is usually sobering. Runners commonly retain:

Each item was added for a defensible reason. Taken together, they describe a machine with more authority than most developer laptops and less oversight than a production server.

The Pivot Path

Chain these together and the value of a runner becomes clear.

A compromised runner usually begins with something small: a malicious dependency that executes during install, a pull request from an external contributor that runs on a shared label, or a build script in a repository the team does not fully control. From there, the first move is reading what is available — environment variables, credential files, the metadata endpoint. The second move is using that to reach source control, then artifact storage, then the deployment path.

Because the runner sits upstream of the artifact that production consumes, this is not a lateral move. It is a straight line. In studios, the same runner that publishes internal builds frequently holds the path to the storefront pipeline, which means the difference between an internal nuisance and a signed build distributed to customers can be a single unscoped credential.

Isolation: Beyond the Container

Containerizing builds is a good first step and rarely sufficient. A container running with the Docker socket mounted is not isolated; it is a proxy for root on the host. A job that can reach the cloud metadata endpoint can obtain the host's instance credentials regardless of what the container's filesystem looks like.

Isolation worth the name includes network egress controls scoped to the destinations a job genuinely needs, no access to host metadata services or a token-brokered equivalent, no shared host directories across jobs, and separate runner pools by trust level. That last point carries the most weight. Builds triggered by forks or external contributors should never share a pool with builds that touch release infrastructure. The convenience of one label for everything is not worth the blast radius.

Scoping Credentials to the Job, Not the Fleet

The single highest-value change most organizations can make is eliminating standing credentials. Issue tokens through workload identity at job start, scope them to the artifact path the job writes to, and let them expire in minutes. Where a long-lived credential is genuinely unavoidable — signing material is the usual culprit — isolate it behind a service that performs the specific operation and refuses everything else, rather than handing the key to the runner.

Rotate on a schedule and on suspicion. A signing credential that has been in the same vault slot for two years has no known provenance and no way to determine exposure.

Lifecycle Discipline

The claim that runners are ephemeral should be verifiable. Automate teardown at the host level, not the workspace level. A job that deletes its working directory has not cleaned anything if the layer beneath it retains the toolchain, the caches, and the environment files. Recycle hosts on a fixed interval regardless of apparent health, and treat any host that cannot be reimaged cleanly as a finding rather than an inconvenience.

A Hardening Checklist

Do the Inventory First

None of this requires a new platform. It requires an afternoon with the fleet, a spreadsheet, and the uncomfortable exercise of writing down what each machine can reach. Most teams find two or three credentials that nobody can account for and one runner group that has been running since a proof of concept three years ago.

The runner is not cattle if it holds the keys to the build. Fortify the stack by treating the build floor with the same discipline as the production perimeter — because from an attacker's point of view, it is the same perimeter.

All Articles

Related Articles

Open by Accident: The Authorization Gaps Hiding in Gaming and Enterprise APIs

Open by Accident: The Authorization Gaps Hiding in Gaming and Enterprise APIs

Shipped Broken, Patched Later: How Early Access Culture Is Dismantling Our Expectations of Software Security

Shipped Broken, Patched Later: How Early Access Culture Is Dismantling Our Expectations of Software Security

Left Behind and Leveraged: The Lifecycle of Abandoned Developer Access in Enterprise Environments

Left Behind and Leveraged: The Lifecycle of Abandoned Developer Access in Enterprise Environments