gh-aw icon indicating copy to clipboard operation
gh-aw copied to clipboard

Rootless threat detection deletes its installed binary before execution

Open jochenschmich-aeberle opened this issue 3 weeks ago • 1 comments

Summary

With gh-aw v1.2.2, external threat detection on a non-ARC/DinD Linux runner fails when runner.installation: rootless is enabled. The installer succeeds, but the generated detection step deletes the installed detector before trying to copy it. The same staging logic is present on current main.

Reproduction

  1. Compile an agentic workflow with runner.installation: rootless and external threat detection, targeting a non-ARC/DinD Linux runner.
  2. Start a run that produces a safe output so the detection job runs.
  3. The rootless installer places the verified executable at $RUNNER_TEMP/gh-aw/bin/threat-detect. The next generated step removes that path and tries to copy the same source file into it, so detection fails before AWF starts.

Expected: the verified detector remains executable and threat detection runs. The job can appear successful because detection continues on error, despite detection not being performed; in the observed run, safe-output handling aborted the output.

Root cause

Related prior work: #75440.

Suggested implementation and tests

  1. In buildExternalDetectorPathSetup, avoid removing or copying the detector when the verified source is already the destination; retain the existing checks for an executable regular file and symlinks.
  2. Add a regression test that executes the generated host setup when source and destination are the same, and a test for a distinct source and destination. Preserve checksum verification and the existing ARC/DinD and privileged paths.
  3. Verify that a rootless non-ARC detection job reaches the detector and produces a detection result without changing safe-output policy.

jochenschmich-aeberle avatar Nov 10 '26 12:11 jochenschmich-aeberle

Same failure on a plain self-hosted Linux runner (not ARC/DinD), gh-aw v1.2.2, with runner.installation: rootless.

"Install threat-detect binary" succeeds and prints threat-detect v0.5.3. The verified binary is installed at $RUNNER_TEMP/gh-aw/bin/threat-detect. The next generated step, "Execute threat detection with AWF", removes that path and then copies $detector onto the same path, so the copy fails:

cp: cannot stat '.../gh-aw/bin/threat-detect': No such file or directory

AWF never starts. "Conclude threat detection" then runs the fail-closed placeholder and exits 1:

ERROR: threat-detect installation did not complete verification
ERR_SYSTEM: threat-detect conclude exited with status 1 without reporting a conclusion

With continue-on-error: false, the detection job fails and safe outputs are skipped. The agent job in the same run succeeded.

priyanka9990 avatar Nov 12 '26 09:11 priyanka9990