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

Threat detection jobs inherit rootless AWF when network-isolation enabled (#41267)

Open Tarekchehahde opened this issue 4 months ago • 2 comments

Problem

Main agent jobs omit sudo when sandbox.agent.sudo: false (network isolation), but detection jobs built synthetic WorkflowData without inheriting parent NetworkIsolation. Generated locks still contained sudo -E awf in detection_agentic_execution while the agent job used rootless awf.

Before (detection job, network-isolation workflow)

run: |
  sudo -E awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" ...

Install step used install_awf_binary.sh without --rootless.

After

run: |
  awf --config "${RUNNER_TEMP}/gh-aw/awf-config.json" ...

Install step passes --rootless when parent agent has network isolation.

Implementation

  • buildThreatDetectionAgentConfig(parent) copies NetworkIsolation, version, runtime from parent agent sandbox
  • Applied in threat_detection_inline_engine.go and threat_detection_external.go
  • Recompiled 256 lock files (zero sudo -E awf remaining)

Fork PR

https://github.com/Tarekchehahde/gh-aw/pull/15

Test plan

  • [x] go test ./pkg/workflow/ -run TestNetworkIsolationRootless
  • [x] TestCompiledLockFiles_SmokeWorkflowsHaveDetectionJobWithAgenticRunCall
  • [x] Fork CI green on PR #15

Out of scope (follow-up)

  • Chroot cleanup EACCES warning on rootless runs
  • Opt-in cross-run cache for none/nopolicy

Fixes #41267

Tarekchehahde avatar Jul 11 '26 16:07 Tarekchehahde

Fork PR: https://github.com/Tarekchehahde/gh-aw/pull/15 — all CGO checks green on fork.

Tarekchehahde avatar Jul 11 '26 16:07 Tarekchehahde

File issues as specs, not forks.

pelikhan avatar Jul 15 '26 06:07 pelikhan