Long-running CI agents increase risk because they combine persistent access with changing workflow context. That means a single non-human identity may see multiple repositories, jobs, and events while retaining enough privilege to act repeatedly. The risk is not just misuse, but accumulated blast radius when permissions and memory outlive the task they were meant to support.
Why long-running CI agents become a governance problem
CI agents are supposed to be temporary workers, but long-lived runners often behave like semi-persistent infrastructure. As they accumulate access to repositories, build systems, package registries, logs, and deployment targets, the operational question changes from “can this job finish?” to “what else can this identity still reach while it lives?” That is where identity risk starts to dominate. Ultimate Guide to NHIs notes that 97% of NHIs carry excessive privileges, which is exactly the kind of condition that turns a convenient runner into a broad access path.
The practical issue is not that a CI agent is malicious by default, but that its permissions, cached state, and trust relationships often outlast the task they were created for. If a runner keeps tokens, workspace context, or environment secrets across multiple jobs, the access boundary becomes fuzzy and harder to audit. In practice, teams usually discover the problem only after a build host or pipeline credential has already been reused in ways nobody intended.
How persistent runners change the blast radius
A short-lived CI job has a narrow security window: it does one task, then disappears. A long-running agent keeps the same identity and runtime context across multiple jobs, which means compromise, misconfiguration, or accidental overreach can compound over time. The risk grows when the runner can access more than one repository, more than one environment, or more than one class of secret. Once that happens, the agent becomes a bridge between workflows that were supposed to remain separate.
- Cached credentials can survive beyond the build that needed them.
- Workspace artifacts can leak context from one job into the next.
- Permissions may be granted for convenience and never reduced.
- Failures become harder to attribute because multiple jobs share one identity.
That matters operationally because CI systems are designed for speed, not careful session hygiene. A persistent runner can keep acting after the original approval context has changed, which is especially dangerous when branches, repositories, or deployment targets vary over time. The same identity may also be reused by automation that was never intended to share trust boundaries. The result is an identity that behaves like infrastructure and an infrastructure component that behaves like an identity, which is exactly where governance becomes fragile. Ultimate Guide to NHIs also reports that only 5.7% of organisations have full visibility into their service accounts, a useful reminder that long-lived automation is often less observable than teams assume.
These controls tend to break down when a single runner is reused across many pipelines because separation of duties, token scope, and credential rotation all get weaker at the same time.
Common variations and edge cases
Tighter runner hygiene often increases operational overhead, because ephemeral agents, job isolation, and short-lived credentials make builds slightly less convenient. That trade-off is usually worth it, but there are environments where a fully ephemeral model is hard to maintain, such as legacy CI estates, self-hosted runners, or pipelines that depend on heavy local caching.
Some teams also underestimate the difference between “long-running” and “highly trusted.” A runner may be stable, healthy, and monitored while still being overprivileged or too broadly reused. The bigger the environment, the more likely it is that one runner quietly spans dev, test, and production-adjacent tasks, which turns an operational shortcut into a governance issue. Current guidance generally favours narrower scopes, shorter credential lifetimes, and stronger runner segmentation over reuse, but the right balance depends on build volume, release cadence, and the sensitivity of the connected systems. If a CI agent can reach production assets, the acceptable lifetime and privilege threshold should be materially lower than for a disposable test runner.
Risk and Threat Considerations
Long-running CI agents increase exposure because they preserve a working identity across changing tasks, secrets, and trust boundaries. That creates a larger opportunity for credential reuse, accidental privilege retention, and lateral movement from one workflow to another.
Failure mechanism: The risk materialises when cached tokens, environment variables, or mounted credentials remain available after the original job, allowing a later build step, compromised dependency, or injected workflow action to reuse them under the same trusted runner context.
Impact: A single compromised runner can expose multiple repositories, pipeline secrets, and deployment paths, while also making audit trails and revocation slower because one identity has served many jobs.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 and MITRE ATT&CK address the attack and risk surface, while CIS Controls v8 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-01 — Secrets and Credential Management | CI runners rely on machine credentials and secret handling across jobs. |
| NHI-02 — Lifecycle and Offboarding | Long-running agents need revocation and cleanup when jobs or trust change. | |
| Recommendation — Use short-lived credentials and rotate runner secrets aggressively. Revoke runner access immediately when its trust scope changes. | ||
| CIS Controls v8 | 6.3 — Access Rights Management | Runner reuse can expand access beyond intended job boundaries. |
| Recommendation — Review and remove excess runner access to repositories and environments. | ||
| NIST CSF 2.0 | PR.AA-01 — Identity Management, Authentication, and Access Control | Persistent CI agents need bounded identity and access control. |
| PR.DS-01 — Data-at-Rest Security | Persistent workspaces can retain secrets and build artifacts between jobs. | |
| Recommendation — Limit runner identity scope and enforce least privilege for automation. Protect and purge stored workspace data after each job completes. | ||
| MITRE ATT&CK | T1552 — Unsecured Credentials | CI agents commonly expose tokens and keys through cached or stored secrets. |
| Recommendation — Hunt for exposed pipeline credentials and remove reusable secret storage. | ||
Practitioner Guidance
What to prioritise: Treat runner lifetime as a security control, not just an operations setting. The first question is whether the agent can be replaced with an ephemeral or job-scoped runner; if not, tighten token scope, workspace cleanup, and secret delivery so the runner never accumulates reusable authority.
What to verify: Confirm whether one runner identity can access more than one repository, environment, or secrets source. If it can, verify that those relationships are intentionally approved, time-bounded, and separately logged; otherwise, the runner should be considered a shared access path, not a simple build resource.
Common mistake: Teams often rotate human credentials but leave CI runners untouched for months. That leaves long-lived automation with stable access while the surrounding controls appear healthy on paper.
Practitioner takeaway: The safest CI design is the one that assumes every extra hour of runner lifetime increases the chance that yesterday’s access will be available for today’s job.
Related resources from NHI Mgmt Group
- Why do long-running AI agents create more operational risk than short-lived requests?
- Why do long-lived API secrets and access tokens increase operational risk in identity automation?
- Why does running unsupported identity security software increase operational and security risk?
- Why do AI agents increase non-human identity risk in existing IAM programmes?