GitHub-hosted runners generally expose the secrets explicitly provided to the job, while CodeBuild-hosted runners also expose the build environment identity, the associated IAM service role, and any network access configured in the AWS account. That means the same workflow can have a much larger blast radius on CodeBuild, especially when the runner sits inside a VPC.
Why the runner choice changes identity exposure
For identity and access risk, the key difference is not only where the code executes, but what identity the runtime can inherit while it executes. GitHub-hosted runners are usually limited to the job-scoped secrets and tokens you explicitly grant. CodeBuild-hosted runners, by contrast, can also inherit the AWS build identity, the attached service role, and any account network access that the build environment can reach. That makes the trust boundary wider and the consequences of a workflow mistake larger. For a practical framing of identity and machine-access risk, OWASP’s OWASP Non-Human Identity Top 10 is a useful reference point.
In practice, many security teams discover the real blast radius only after a pipeline has already been trusted to assume more than the workflow author expected.
What the two runner models actually expose
GitHub-hosted runners are closer to a short-lived execution surface: the main access risk comes from what the workflow receives at job start, such as secrets, repository token permissions, and any temporary credentials explicitly minted for that run. That can still be dangerous, but the exposure is usually bounded by the workflow definition and the permissions the platform grants to that job.
CodeBuild-hosted runners add a second layer of identity and access concern because the build container or environment can operate with AWS-native identity attached to it. In practice, that means the workflow may be able to reach resources through the build service role, interact with S3, ECR, KMS, Secrets Manager, or other AWS services, and potentially traverse whatever internal network paths the environment can see. If the build runs inside a VPC, the access question changes again because the build is no longer just a code runner; it is also a networked workload with east-west reach.
- GitHub-hosted risk is mostly about job-scoped secrets, token scope, and repository permissions.
- CodeBuild-hosted risk includes those same concerns plus AWS IAM role scope and network reachability.
- The failure point is often overbroad service-role permissions, not the build script itself.
This guidance breaks down when teams assume “hosted runner” means “equivalent isolation” across platforms, because the identity model and network boundary are not equivalent.
Where the comparison changes in edge cases
Tighter build isolation often reduces convenience, requiring teams to balance developer speed against the smaller attack surface that comes from narrower credentials and network paths. The important nuance is that the runner label alone does not determine risk; the permission model, secret delivery pattern, and whether the job can reach internal infrastructure matter just as much.
CodeBuild-hosted runners are especially sensitive when the AWS service role has broad wildcard permissions or when temporary credentials are reused across multiple steps, because a single workflow compromise can become a multi-service AWS access issue. GitHub-hosted runners can also be risky if they are given long-lived secrets or overly permissive OIDC trust, but the usual failure mode is narrower: the job accesses what it was handed, rather than inheriting a broader cloud runtime identity.
For teams comparing the two, the useful question is whether the workflow needs cloud-native reach or merely ephemeral execution. If it does not need AWS-side identity or private network access, the broader CodeBuild trust boundary is often unnecessary. If it does, the access model needs to be designed as if the runner itself were a privileged workload.
That distinction matters most when the workflow is allowed to call internal APIs or reach production data paths, because then the runner ceases to be a convenience layer and becomes part of the organization’s identity perimeter.
Risk and Threat Considerations
The material risk is privilege amplification through the build environment itself. On CodeBuild-hosted runners, a workflow compromise can extend beyond the secrets in the job definition and into the AWS identity, role permissions, and network paths attached to the build. That widens the exposure surface and increases the chance that a stolen token or malicious dependency can be turned into broader cloud access.
Failure mechanism: An attacker or malicious dependency abuses the permissions already granted to the runner environment, then uses that trusted execution context to query AWS services, retrieve additional credentials, or pivot into reachable internal resources. The risk is driven by overbroad IAM roles, weak secret scoping, and implicit trust in the build network.
Impact: A single pipeline compromise can become cloud resource access, secret disclosure, data exfiltration, or internal network reachability beyond the workflow’s intended scope. In the worst case, the runner becomes a practical escalation point rather than a disposable execution host.
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 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 | Build runners expose job and cloud credentials, making non-human identity handling central. |
| Recommendation — Minimise runner credentials and revoke any machine access that the job does not strictly need. | ||
| CIS Controls v8 | 6 — Access Control Management | The question is about comparing access scope and blast radius across runner types. |
| Recommendation — Restrict runner permissions to the smallest service-role and secret set required. | ||
| NIST CSF 2.0 | PR.AA — Identity Management, Authentication, and Access Control | Runner choice directly changes identity scope, authentication trust, and access boundaries. |
| PR.PS — Platform Security | Hosted runners differ in runtime isolation, network reach, and workload hardening needs. | |
| PR.IR — Technology Infrastructure Resilience | A compromised runner can become a pivot point into broader cloud and network exposure. | |
| Recommendation — Define and enforce distinct access boundaries for each runner environment. Harden the runner platform and isolate network access according to its trust level. Limit blast radius so runner compromise cannot expand into wider infrastructure access. | ||
Practitioner Guidance
What to verify: Confirm whether the workflow needs cloud-native identity at all. If it does, verify the exact AWS role scope, the trust policy, and the network paths exposed to the build before you treat the runner as a routine CI execution target.
Decision rule: If the job only needs ephemeral execution, keep the identity surface as close as possible to job-scoped credentials. If the job needs AWS services or private connectivity, treat the runner as a workload identity with explicit blast-radius limits, not as a neutral build host.
What practitioners underestimate: The build environment often becomes the real security boundary, not the repository or the pipeline file. That is why the same code change can be low risk on one runner type and materially higher risk on the other.
Practitioner takeaway: Compare runner types by inherited authority, not by branding. The more the build environment can assume cloud identity or network reach, the more carefully its permissions must be engineered and reviewed.
Related resources from NHI Mgmt Group
- What is the difference between access review completion and access risk reduction?
- What is the difference between reviewing human access and reviewing NHIs?
- What is the difference between role-based access and API key governance for NHI security?
- What is the difference between patching a vulnerability and reducing identity blast radius?