GitHub Actions / Identity, coordination, and governance / Lesson 21
Runner lifecycle and trust isolation
Review self-hosted runner access, lifecycle and cleanup across different workflow trust levels.
On this page
Lesson goals
- Map a job’s code trust to runner and credential boundaries.
- Test runner cleanup and access isolation with disposable resources.
Map the runner trust boundary
A self-hosted runner executes workflow code with the permissions, network access and filesystem available to its host. Identify which repositories and events can schedule it, who can change the executed code and which credentials or internal services are reachable. A runner label is a routing selector, not by itself proof of isolation. Review the deployed GitHub product and organization policy before relying on a feature.
Describe a release runner
The first fixture describes a synthetic runner group intended for a protected release job with a one-job lifecycle. It is a planning record, not a GitHub configuration or proof that the host is ephemeral. Verify registration, host destruction or reset, workspace cleanup and network policy in the actual implementation. Retain only sanitized runner identity and release evidence.
{"runner_group":"trusted-release","job_source":"protected-revision","lifecycle":"one-job"}
The fixture names an intended trust and lifecycle; it provisions no runner.
Separate an external contribution
The second fixture places an external contribution in an isolated test boundary. Workflow code from an untrusted source must not gain release credentials or unnecessary internal access merely because it needs tests. A short-lived runner registration alone does not guarantee that the underlying host or attached volumes are clean. Define how the entire execution environment is reset or destroyed after the job.
{"runner_group":"untrusted-test","job_source":"external-contribution","lifecycle":"isolated"}
The record describes a separate intended environment and performs no scheduling.
Inspect persistence and egress
Review workspaces, caches, temporary files, process state, credentials and network egress as separate persistence or access paths. Avoid placing secrets in logs or reusable caches. An apparently clean workspace may not remove a background process or an attached volume, and deregistering a runner does not itself establish host destruction. Use the platform’s supported controls and the organization’s infrastructure lifecycle.
Test the isolation contract
In a disposable environment, run a synthetic job that writes a harmless marker, then verify that a later job in the intended clean environment cannot read it. Test one approved and one denied network or credential operation using test resources, and inspect host teardown evidence. Include failure and cancellation paths. Record the actual runner image and lifecycle; this lab does not prove isolation for an unrelated production fleet.
Common errors and fixes
An external contribution runs with release credentials.
- Why it happens
- Event trust and runner access were not separated.
- How to fix it
- Remove the privileged access and follow the credential response process.
- Prevent it next time
- Route untrusted jobs to isolated disposable resources.
A removed runner leaves reusable host state.
- Why it happens
- Runner deregistration was confused with host cleanup.
- How to fix it
- Rebuild or destroy the affected environment under its lifecycle policy.
- Prevent it next time
- Verify cleanup of hosts, volumes and processes.
A label is treated as proof of isolation.
- Why it happens
- Routing metadata replaced access verification.
- How to fix it
- Inspect actual permissions, network and host controls.
- Prevent it next time
- Test permitted and denied operations.
2 practice exercises
1. Does the one-job label in the first fixture prove the host is destroyed after use?
Show worked solution
No. It is a declared planning value. Verify the actual runner registration and the separate host, workspace and volume lifecycle with infrastructure evidence.
2. Why should a test runner for an external contribution lack release credentials?
Show worked solution
The contribution can influence executed code. Restricting the runner and credential boundary limits what that code can access; validate the separation using disposable identities and resources.
Key takeaways
- Map event and code trust to runner, host and credential boundaries.
- Verify host cleanup and denied access rather than relying on labels.