You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Analysis: Why harden-runner crashes on ubuntu-slim and potential paths forward
Root cause
ubuntu-slim runners are GitHub Hosted Compute Agent Docker containers (base image ubuntu:24.04). The isDocker() check in setup.ts does not detect them because the is-docker package checks for /.dockerenv (absent) and Docker cgroup entries (absent in Hosted Compute Agent containers).
When isDocker() returns false, harden-runner proceeds to install the Linux agent, which crashes at:
This follows the existing pattern for isDocker(), isARCRunner(), and other unsupported runner checks. Added to both setup.ts and cleanup.ts.
Could full ubuntu-slim support be implemented?
Fixable (proper solutions, not workarounds):
Blocker
Fix
Notes
process.env.USER undefined
os.userInfo().username
Node.js ` independent of env vars
No systemd
cp.spawn() detached process
Pattern already exists in installWindowsAgent
No journalctl
Read from /home/agent/agent.log
Cleanup already reads this file
Likely blocked (container runtime limitations):
Blocker
Issue
eBPF agent (TLS variant)
Requires CAP_BPF / CAP_SYS_ not available in Docker without --privileged`
Non-TLS agent monitoring
Requires `CAP_NET_ uncertain if available
Network namespace
Docker containers have isolated networking that may interfere with monitoring
The existing CONTAINER_MESSAGE ("...can be monitored by installing Harden Runner in a custom VM image...") suggests containers are intentionally unsupported. Full support would require verifying agent monitoring works inside containers and adding a non-systemd process management path for Linux.
The PR has been merged and we will be releasing a new version shortly. To set expectations on what it does and doesn't do:
What the fix changes
Harden-Runner will detect ubuntu-slim runners and exit cleanly with an informational log message, instead of crashing on
chown: invalid user: 'undefined'.
What the fix does not do
Jobs running on ubuntu-slim will not be monitored by Harden-Runner. The agent relies on kernel-level features (that require elevated capabilities).
Per GitHub's docs on single-CPU runners: "The container for ubuntu-slim runners runs in unprivileged mode. This means that some operations requiring elevated privileges such as mounting file systems, using Docker-in-Docker, or accessing low-level kernel features are not supported." Those low-level kernel features are what the agent needs, so monitoring inside the unprivileged container is not feasible today.
For StepSecurity enterprise customers
If your security posture requires that workflows are always monitored, you can block the use of ubuntu-slim via workflow run policies see the Runner Label Policy docs. This lets you enforce that jobs only run on monitored runner types.
Activity
jacobwoffenden commentedon Jan 29, 2026
Tagging along on to this to add
Source
chore: use ubuntu-latest
fix(ci): remove harden-runner from agentic workflows
fix: handle undefined USER env var on ubuntu-slim runners
fix(ci): remove harden-runner from agentic workflows
fix: detect ubuntu-slim runners early and bail out
fix(ci): remove harden-runner from agentic workflows (#3916)
devantler commentedon Apr 11, 2026
Analysis: Why harden-runner crashes on
ubuntu-slimand potential paths forwardRoot cause
ubuntu-slimrunners are GitHub Hosted Compute Agent Docker containers (base imageubuntu:24.04). TheisDocker()check insetup.tsdoes not detect them because theis-dockerpackage checks for/.dockerenv(absent) and Docker cgroup entries (absent in Hosted Compute Agent containers).When
isDocker()returnsfalse, harden-runner proceeds to install the Linux agent, which crashes at:process.env.USERisundefinedbecause bareubuntu:24.04containers do not set theUSERenvironment variable.Environment comparison
ubuntu-latestubuntu-slimubuntu:24.04RUNNER_ENVIRONMENTgithub-hostedgithub-hostedprocess.env.USERrunnerundefined/.dockerenvisDocker()falsefalseImmediate fix (PR #657)
PR #657 adds early bail-out detection:
This follows the existing pattern for
isDocker(),isARCRunner(), and other unsupported runner checks. Added to bothsetup.tsandcleanup.ts.Could full ubuntu-slim support be implemented?
Fixable (proper solutions, not workarounds):
process.env.USERundefinedos.userInfo().usernamecp.spawn()detached processinstallWindowsAgentjournalctl/home/agent/agent.logLikely blocked (container runtime limitations):
CAP_BPF/CAP_SYS_ not available in Docker without--privileged`The existing
CONTAINER_MESSAGE("...can be monitored by installing Harden Runner in a custom VM image...") suggests containers are intentionally unsupported. Full support would require verifying agent monitoring works inside containers and adding a non-systemd process management path for Linux.References
JakobJingleheimer commentedon Apr 25, 2026
@varunsh-coder gentle nudge.
ubuntu-slimspeeds up our CI rather significantly.varunsh-coder commentedon May 2, 2026
Thanks @devantler for the analysis and PR #657.
The PR has been merged and we will be releasing a new version shortly. To set expectations on what it does and doesn't do:
What the fix changes
chown: invalid user: 'undefined'.
What the fix does not do
For StepSecurity enterprise customers
If your security posture requires that workflows are always monitored, you can block the use of ubuntu-slim via workflow run policies see the Runner Label Policy docs. This lets you enforce that jobs only run on monitored runner types.
JakobJingleheimer commentedon May 2, 2026
Thanks @varunsh-coder. Unfortunate that it's fundamentally impossible. Is there perchance a subset that would be sufficient if added to ubuntu-slim?