Self-Hosted Git Runner Security Hardening Checklist
self-hostedsecurityci-runnersdevopssecrets-managementinfrastructure

Self-Hosted Git Runner Security Hardening Checklist

OOpenDev Forge Editorial Team
2026-11-28
8 min read

A practical checklist for securing self-hosted CI runners with isolation, least privilege, secret controls, network limits, patching, and recurring reviews.

A self-hosted CI runner executes code inside infrastructure you control, which makes it useful for private builds and custom deployment workflows but also gives untrusted or semi-trusted jobs a path toward your network, files, credentials, and build artifacts. This checklist explains how to secure a self-hosted CI runner through isolation, least privilege, secret controls, ephemeral environments, network restrictions, dependency-cache hygiene, logging, patching, and cleanup. Use it when deploying a runner, changing repository permissions, rotating credentials, or reviewing a build environment.

Overview

The safest runner design begins with a clear trust model. A runner that processes only reviewed jobs from a small private repository has a different exposure level from one that accepts pull requests from forks, runs contributions from many teams, or builds code that changes frequently. Treat every job as potentially capable of reading the runner's workspace and using the permissions available to its process.

Do not assume that a container automatically makes a runner safe. Containers can reduce accidental interference, but they share parts of the host kernel and may expose mounted files, sockets, devices, or credentials. A virtual machine generally provides a stronger isolation boundary, while an ephemeral runner limits the time available for persistence. The right control depends on the code's trust level, the assets reachable from the runner, and the operational effort your team can maintain.

For broader architecture decisions, pair this checklist with a self-hosted CI/CD runner guide. The goal is not to eliminate every risk; it is to make the runner's permissions, boundaries, and recovery process deliberate and auditable.

Runner risk comparison

Runner modelTypical strengthsMain risksControls to prioritize
Shared persistent runnerSimple administration and good utilizationWorkspace residue, cross-project access, and persistence after a jobStrict job isolation, workspace cleanup, narrow labels, strong monitoring, and no sensitive workloads unless trust is equivalent
Dedicated persistent runnerPredictable tools and separation by team or workloadLong-lived credentials, host drift, and compromise surviving between jobsDedicated identity, patching, restricted network paths, cleanup, and regular rebuilds
Containerized runnerRepeatable environments and reduced host modificationContainer escape, exposed host sockets, privileged mode, and unsafe mountsRootless operation where practical, minimal images, read-only mounts, dropped capabilities, and no unnecessary host socket access
Virtual-machine runnerStronger boundary and flexible operating-system isolationImage drift, management overhead, and broad network permissionsHardened images, rapid replacement, limited service accounts, segmented networking, and verified teardown

What to track

Maintain a small runner inventory rather than relying on memory or settings scattered across repositories. For every runner, record its owner, host or pool, operating system, runner version, labels, repositories or groups it can serve, network zones, service account, installed tools, persistence model, and last rebuild date. An inventory turns an abstract security review into a list of systems that can be checked.

1. Isolation and execution boundaries

  • Assign untrusted jobs to separate runners from release, signing, and production-deployment jobs.
  • Use ephemeral runners for workloads that process unreviewed changes, external contributions, or sensitive build inputs when your platform supports that model.
  • Do not run the runner service as an operating-system administrator or root unless a documented requirement exists and compensating controls are in place.
  • For containers, review privileged flags, mounted directories, host paths, device access, container sockets, Linux capabilities, and writable filesystems.
  • For virtual machines, use a minimal image and make replacement easier than manual repair.

2. Tokens, identities, and permissions

Use a separate service identity for each runner group or trust boundary. Grant only the repository, project, registry, artifact, and deployment permissions required by the jobs it executes. Prefer short-lived credentials or platform-issued job tokens where available. Review whether tokens can write source code, create releases, modify pipeline definitions, access deployment environments, or read secrets; these permissions should not be bundled by default.

Keep runner registration credentials out of source control, image layers, shell history, and reusable logs. Store administrative credentials in an approved secrets manager and define who may register, remove, or reassign runners. Rotate credentials after suspected exposure, staff or ownership changes, runner migration, or accidental logging.

3. Secrets and sensitive files

  • Expose secrets only to jobs and environments that need them, and avoid making production secrets available to ordinary test jobs.
  • Prevent commands from printing environment variables, configuration files, access tokens, or private keys.
  • Review masking behavior rather than assuming every transformed, encoded, or split secret will be hidden.
  • Remove credentials from temporary files and ensure cleanup runs after both successful and failed jobs.
  • Use separate credentials for building, publishing, deployment, and signing. A build job should not automatically receive release authority.

Release credentials deserve an additional boundary. If your workflow signs artifacts, keep signing keys away from general-purpose runners where possible and review the related Sigstore and Cosign release-signing guidance.

4. Network access

Start with deny-by-default network access and add only the destinations the job requires. Separate source control, package registries, artifact storage, deployment endpoints, internal databases, and administrative interfaces into distinct access paths. A build runner rarely needs unrestricted access to an internal network. Restrict outbound traffic where feasible, limit inbound access to runner management requirements, and avoid exposing a runner directly to the public internet.

5. Dependencies and caches

Caches improve build speed but can preserve untrusted files or allow one job to influence another. Scope caches by repository, branch, operating system, and dependency context when supported. Do not cache credentials, deployment files, generated configuration containing secrets, or arbitrary workspace directories. Review cache restore behavior for pull requests and untrusted branches, and periodically invalidate caches after dependency or runner changes.

Pin important build actions, container images, and tool versions to reviewed references where practical. Generate and review software inventories for releases using an SBOM workflow, and treat dependency updates as a change to the build environment rather than merely a speed or convenience update.

6. Logging, patching, and cleanup

Collect runner registration events, job start and completion records, permission changes, image or operating-system changes, failed authentication attempts, and unusual outbound connections. Logs should support investigation without recording secret values. Alert on a runner appearing under an unexpected label, serving an unexpected repository, or accessing a network destination outside its normal pattern.

Patch the host operating system, runner software, container runtime, installed language tools, and base images on a defined schedule. Remove unsupported components and rebuild rather than endlessly modifying long-lived machines. After each job, delete the workspace, temporary credentials, generated files, package-manager credentials, and untracked artifacts. Verify cleanup with a test job that looks for residue.

Cadence and checkpoints

A recurring review is more reliable than a one-time hardening project. Use the following schedule as a baseline, then increase the frequency for runners that handle release signing, production deployment, or untrusted code.

  • Every job: confirm the job uses the intended runner label, receives only expected secrets, and leaves no sensitive workspace files behind.
  • Weekly or after significant pipeline changes: review new workflow definitions, permissions, cache paths, third-party actions, container settings, and network destinations.
  • Monthly: compare the runner inventory with actual registrations, check patch status, inspect failed jobs and unusual access, test cleanup, and remove unused labels or identities.
  • Quarterly: rebuild or replace persistent runners where practical, review the trust separation between test and release workloads, rotate selected credentials, and test the response plan for a compromised runner.
  • After a security event or major platform release: reassess supported runner versions, permission defaults, isolation behavior, container guidance, token handling, and registration procedures before returning affected runners to service.

Record each review with the date, reviewer, runners examined, exceptions accepted, and corrective actions. A short record makes recurring changes visible and prevents known exceptions from becoming permanent.

How to interpret changes

Not every change indicates a compromise, but every unexplained change deserves a bounded investigation. A sudden increase in failed jobs may reflect a tool update, while a new outbound destination combined with a changed workflow deserves more scrutiny. Interpret signals in context rather than using one metric as proof of safety.

  • New runner or label: verify who created it, which repositories can select it, what identity it uses, and whether it belongs in that trust boundary.
  • New permission: identify the exact job that needs it, shorten its lifetime if possible, and separate read, publish, deploy, and administrative functions.
  • Unexpected network traffic: compare it with dependency installation and artifact publishing requirements, then investigate unknown destinations before allowing the pattern.
  • Cache growth or cross-branch failures: check whether cache keys are too broad or whether untrusted jobs can restore artifacts produced by trusted jobs.
  • Repeated host modifications: treat drift as a signal to rebuild the runner from a known image instead of adding another manual exception.
  • Secret exposure: revoke and replace the credential first, preserve relevant logs, identify where it appeared, and then correct the workflow that disclosed it.

If a runner may be compromised, stop assigning new jobs to it, preserve evidence according to your incident process, revoke its registration and credentials, and rebuild from a trusted source. Do not treat deleting the workspace alone as proof that persistence has been removed.

When to revisit

Revisit this checklist at least monthly for active self-hosted CI/CD environments and conduct a deeper review quarterly. Return sooner when you add a repository or team, change from private to public contributions, introduce pull-request builds, add a deployment target, install a new container runtime, change cache behavior, rotate credentials, or move runners between networks.

Before adding a runner, complete a short go-live review: define its trust boundary, create its dedicated identity, document allowed repositories and network destinations, choose container or virtual-machine isolation, verify secret scope, test cleanup, enable useful logging, and confirm how the runner will be patched or replaced. After deployment, run a harmless test job that checks workspace cleanup, permission limits, cache scope, and expected network access.

Use the inventory as a living control. Mark each item as verified, changed, or requiring remediation, and assign an owner and due date for exceptions. When a platform release changes runner versions, permission settings, container behavior, or token handling, update this review before relying on old assumptions. For adjacent infrastructure, see the guides to self-hosted container registries and self-hosted Git server recovery. A secure runner is not a one-time configuration; it is a maintained part of your open-source hosting and deployment system.

Related Topics

#self-hosted#security#ci-runners#devops#secrets-management#infrastructure
O

OpenDev Forge Editorial Team

Senior SEO Editor

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.