Join our Newsletter — 33% off our NHI Course

What is the difference between running builds on the Jenkins controller and using isolated agents?

Running builds on the controller gives pipeline code direct access to the Jenkins filesystem, workspace, configuration, and encrypted secrets, which concentrates risk in one high-value node. Isolated agents separate execution from control, so a compromised build has a smaller blast radius. That separation also makes it easier to apply tighter permissions and safer network boundaries.

Why This Matters for Security Teams

Running builds on the controller turns a coordination node into an execution node, which is usually the wrong way round for a CI/CD platform. The controller tends to hold the highest-value assets: job definitions, credentials, plugin state, and broad access to build history and configuration. If pipeline code executes there, a single build can pivot from “compilation task” into “platform compromise” because the runtime and the control plane are no longer separated.

Isolated agents change the trust boundary. They let the controller remain focused on orchestration while limiting what any one build can see or reach. That matters for secrets handling, filesystem exposure, and network exposure, especially when builds consume third-party dependencies or run untrusted pull requests. The distinction is not cosmetic: it directly changes blast radius, recovery effort, and how much damage a malicious or simply broken pipeline can do.

In practice, many teams discover the weakness only after a plugin issue, poisoned dependency, or hostile branch has already touched the controller rather than during design review.

How It Works in Practice

The practical difference is about where execution authority lives. On a controller-based setup, build steps run on the same node that manages scheduling and stores the most sensitive Jenkins state. That means a build can often read local files, inspect workspace contents, and interact with controller-resident secrets or configuration in ways that are hard to contain once the pipeline code is trusted to execute there.

With isolated agents, the controller dispatches work to separate nodes or ephemeral runtimes. The agent should be treated as the execution boundary, not a convenience proxy. A well-designed setup usually includes:

  • Minimal agent images with only the tools needed for the job.
  • Restricted network paths so the agent can reach only required services.
  • Per-job or per-branch workspaces that do not persist sensitive state longer than needed.
  • Credentials injected only for the duration of the build step that needs them.
  • Separate permissions for scheduling, building, artifact publishing, and administrative actions.

That separation does not eliminate risk, but it changes the failure mode. A compromised build on an agent should expose that agent’s scope, not the whole Jenkins control plane. It also makes stronger controls easier to apply, because you can harden agents by function, environment, or trust level instead of forcing one security posture on every build. For supply-chain-sensitive pipelines, that isolation is often paired with provenance checks such as SLSA so the build system can prove what ran and where it ran.

These controls tend to break down when teams reuse long-lived agents with broad network reach, shared caches, or mounted controller data because the agent starts to inherit the same exposure it was meant to absorb.

Common Variations and Edge Cases

Tighter isolation often increases operational overhead, so organisations have to balance security with speed, cost, and build ergonomics. The strongest pattern is not always “ephemeral everywhere”, especially for heavyweight builds, GPU workloads, or specialised toolchains that are expensive to spin up for every run.

A few edge cases matter:

  • Shared agents can be acceptable for low-risk jobs, but they need stricter workspace cleanup and tighter secret scoping.
  • Ephemeral agents reduce persistence risk, yet they can complicate caching, artifact reuse, and debugging.
  • Controller-side execution may still appear in legacy jobs, but it should be treated as a deliberate exception rather than a default.
  • Highly privileged release pipelines may need stronger segregation than ordinary CI jobs because the consequence of compromise is higher.

Best practice is evolving toward least-privilege execution with short-lived agents, but there is no universal standard that fits every Jenkins estate. The deciding factor is usually whether the build environment can be assumed hostile, semi-trusted, or fully trusted, because that determines how much separation is required and how much friction the team can tolerate. For teams using NHI-heavy delivery pipelines, the risk is compounded when build jobs depend on long-lived secrets exposed in CI/CD tooling, which is why Ultimate Guide to NHIs is a useful companion reference for understanding credential exposure and rotation pressure. Tighter isolation is most valuable when builds are externally sourced, highly privileged, or difficult to fully trust.

Risk and Threat Considerations

Running builds on the controller creates a concentration risk: the same node that schedules work also becomes the most attractive compromise target. If an attacker can influence pipeline code, dependencies, or build inputs, controller execution makes it easier to reach secrets, configuration, and other high-value state in one step.

Failure mechanism: The attacker or faulty build abuses the controller’s broader access to read local state, abuse credentials, tamper with jobs, or persist through configuration changes. Without isolation, a compromise in one pipeline can become platform-wide because the control plane and execution plane overlap.

Impact: The result can be secret exposure, unauthorized job manipulation, supply-chain compromise, or loss of trust in build provenance. Recovery is usually slower too, because the controller often has to be treated as potentially contaminated, not just the failing job.

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 address the attack and risk surface, while NIST CSF 2.0 and CIS Controls v8 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
NIST CSF 2.0 PR.AC — Access Control Controller vs agent separation is an access-control boundary issue.
Recommendation — Limit build permissions and isolate execution paths to reduce blast radius.
CIS Controls v8 6 — Access Control Management Least-privilege access and segregation of duties fit CI build isolation.
Recommendation — Separate controller rights from build-node rights and revoke excess access.
OWASP Non-Human Identity Top 10 NHI-01 — Secrets and Credential Management Controller builds can expose CI secrets and long-lived credentials.
Recommendation — Keep secrets off the controller and scope them to the shortest build step.

Practitioner Guidance

What to prioritise: Treat controller execution as an exception that needs explicit justification. The highest-value control is reducing what the controller can execute, see, and inherit from builds, because that is where the blast radius becomes unacceptable.

What to verify: Confirm that agents cannot read controller-local secrets, mount shared state unnecessarily, or reach administrative endpoints. If a build needs broad network or filesystem access to succeed, that is usually a sign the job should be redesigned rather than merely allowed more access.

What good looks like: A compromised build should be contained to a disposable or tightly scoped agent, with limited credentials, bounded network paths, and fast teardown. If the failure of one job could still alter controller state, the separation is incomplete.

Practitioner takeaway: The goal is not to make builds harmless, but to ensure that build failure cannot become control-plane failure.