1
0
Fork 0
mirror of synced 2026-06-05 16:28:19 +00:00

fix: detect ubuntu-slim runners early and bail out

ubuntu-slim runners (Hosted Compute Agent Docker containers) are
GitHub-hosted but lack the standard USER environment variable set
on full VM-based runners. This causes chownForFolder to fail with
'chown: invalid user: undefined'.

Instead of patching chownForFolder, detect ubuntu-slim early
informative message, matching the existing patterns for isDocker(),
isARCRunner(), and other unsupported runner types.

Fixes #627

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Nikolai Emil Damm 2026-04-11 11:59:22 +02:00
commit 376d25a97f
No known key found for this signature in database
GPG key ID: D5788CEDDFF3C12E
3 changed files with 13 additions and 0 deletions

View file

@ -26,6 +26,11 @@ import { isPlatformSupported, isAgentInstalled } from "./utils";
return; return;
} }
if (isGithubHosted() && process.platform === "linux" && !process.env.USER) {
console.log(common.UBUNTU_SLIM_MESSAGE);
return;
}
if (isARCRunner()) { if (isARCRunner()) {
console.log(`[!] ${common.ARC_RUNNER_MESSAGE}`); console.log(`[!] ${common.ARC_RUNNER_MESSAGE}`);
return; return;

View file

@ -148,3 +148,6 @@ export const ARM64_RUNNER_MESSAGE =
export const ARM64_WINDOWS_RUNNER_MESSAGE = export const ARM64_WINDOWS_RUNNER_MESSAGE =
"Windows ARM runners are not yet supported by Harden-Runner."; "Windows ARM runners are not yet supported by Harden-Runner.";
export const UBUNTU_SLIM_MESSAGE =
"This job is running on an ubuntu-slim runner (GitHub-hosted Linux container without a standard USER environment variable). Harden Runner is not supported on ubuntu-slim runners. This job will not be monitored.";

View file

@ -64,6 +64,11 @@ interface MonitorResponse {
return; return;
} }
if (isGithubHosted() && process.platform === "linux" && !process.env.USER) {
console.log(common.UBUNTU_SLIM_MESSAGE);
return;
}
var correlation_id = uuidv4(); var correlation_id = uuidv4();
var api_url = STEPSECURITY_API_URL; var api_url = STEPSECURITY_API_URL;
var web_url = STEPSECURITY_WEB_URL; var web_url = STEPSECURITY_WEB_URL;