Commit 70040a5
fix: reclaim stale root-owned /tmp/gh-aw before AWF invocation (#44022)
* fix: reclaim stale root-owned /tmp/gh-aw before AWF invocation
On persistent runners, a previous AWF run can leave /tmp/gh-aw/sandbox/
owned by root. The next run's setup.sh does `rm -rf /tmp/gh-aw` which
silently fails (EACCES), then AWF's mkdirSync fails with:
EACCES: permission denied, mkdir '/tmp/gh-aw/sandbox/firewall/logs'
## Changes
### actions/setup/setup.sh
- Check if /tmp/gh-aw is writable before attempting removal
- Fall back to `sudo rm -rf` when the directory (or its children) are
not writable by the current user
- Works on GitHub-hosted runners where sudo is passwordless
### pkg/workflow/engine_firewall_support.go
- Add best-effort `chmod -R a+rX` in network-isolation mode (non-sudo)
- Previously, the post-run chmod was skipped entirely when network-isolation
was enabled, assuming rootless == no root-owned files. This is incorrect:
Docker containers still write as non-runner UIDs (Squid: UID 13), and if
AWF is killed by timeout/OOM, its cleanup never runs.
### pkg/workflow/engine_firewall_support_test.go
- Update test assertions to expect non-sudo chmod in network-isolation mode
Ref: https://github.com/github/gh-aw/actions/runs/28856007222/job/85583002595
Supersedes: #42400
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>1 parent afad433 commit 70040a5
3 files changed
Lines changed: 41 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
96 | 119 | | |
97 | 120 | | |
98 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
147 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
148 | 151 | | |
149 | 152 | | |
150 | 153 | | |
151 | 154 | | |
152 | 155 | | |
153 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
154 | 162 | | |
155 | 163 | | |
156 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
304 | 309 | | |
305 | 310 | | |
306 | 311 | | |
| |||
0 commit comments