Skip to content

Commit a15bf9d

Browse files
committed
Prepend system bin dirs to PATH when allowed_non_write_users is set
Ensures later steps resolve standard tools like git and tar from /usr/bin regardless of what setup actions added earlier in the job. Also strengthens the PAT guidance in security.md. :house: Remote-Dev: homespace
1 parent 25474bf commit a15bf9d

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

action.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,14 @@ runs:
233233
mkdir -p "$GITHUB_ACTION_PATH/bin"
234234
cp "$(command -v bun)" "$GITHUB_ACTION_PATH/bin/bun"
235235
236+
- name: Prepend system bin dirs to PATH
237+
if: ${{ inputs.allowed_non_write_users != '' && runner.os != 'Windows' }}
238+
continue-on-error: true
239+
shell: /bin/bash --noprofile --norc -e -o pipefail {0}
240+
run: |
241+
echo "/usr/bin" >> "$GITHUB_PATH"
242+
echo "/bin" >> "$GITHUB_PATH"
243+
236244
- name: Run Claude Code Action
237245
id: run
238246
shell: bash
@@ -342,6 +350,32 @@ runs:
342350
OTEL_LOGS_EXPORT_INTERVAL: ${{ env.OTEL_LOGS_EXPORT_INTERVAL }}
343351
OTEL_RESOURCE_ATTRIBUTES: ${{ env.OTEL_RESOURCE_ATTRIBUTES }}
344352

353+
- name: Re-prepend system bin dirs to PATH
354+
if: ${{ always() && inputs.allowed_non_write_users != '' && runner.os != 'Windows' }}
355+
continue-on-error: true
356+
shell: /bin/bash --noprofile --norc -e -o pipefail {0}
357+
env:
358+
BASH_ENV: ""
359+
LD_PRELOAD: ""
360+
LD_LIBRARY_PATH: ""
361+
NODE_OPTIONS: ""
362+
DYLD_INSERT_LIBRARIES: ""
363+
DYLD_PRELOAD: ""
364+
DYLD_LIBRARY_PATH: ""
365+
DYLD_FRAMEWORK_PATH: ""
366+
run: |
367+
echo "/usr/bin" >> "$GITHUB_PATH"
368+
echo "/bin" >> "$GITHUB_PATH"
369+
{
370+
echo "BASH_ENV="
371+
echo "LD_PRELOAD="
372+
echo "LD_LIBRARY_PATH="
373+
echo "DYLD_INSERT_LIBRARIES="
374+
echo "DYLD_PRELOAD="
375+
echo "DYLD_LIBRARY_PATH="
376+
echo "DYLD_FRAMEWORK_PATH="
377+
} >> "$GITHUB_ENV"
378+
345379
- name: Cleanup SSH signing key
346380
if: always() && inputs.ssh_signing_key != ''
347381
shell: bash

docs/security.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
- Is designed for automation workflows where user permissions are already restricted by the workflow's permission scope
1616
- When set, Claude does a best-effort scrub of Anthropic, cloud, and GitHub Actions secrets from subprocess environments. On Linux runners with bubblewrap available, subprocesses additionally run with PID-namespace isolation. This reduces but does not eliminate prompt injection risk — keep workflow permissions minimal and validate all outputs. Set `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB: 0` in your workflow or job `env:` block to opt out.
1717
- Optionally set `CLAUDE_CODE_SCRIPT_CAPS` in your workflow `env:` block to limit how many times Claude can call specific scripts per run. Value is JSON: `{"script-name.sh": maxCalls}`. Example: `CLAUDE_CODE_SCRIPT_CAPS: '{"edit-issue-labels.sh":2}'` allows at most 2 calls to `edit-issue-labels.sh`. Useful for write-capable helper scripts.
18-
- When using `allowed_non_write_users`, always pass `github_token: ${{ secrets.GITHUB_TOKEN }}`. The auto-generated workflow token is scoped to the job's declared permissions and expires automatically, which limits blast radius. Personal access tokens are not recommended for untrusted-input workflows.
18+
- When using `allowed_non_write_users`, always pass `github_token: ${{ secrets.GITHUB_TOKEN }}`. The auto-generated workflow token is scoped to the job's declared permissions and expires when the job completes. **Do not use a personal access token** — a static token does not rotate between runs, and depending on the tools allowed via `claude_args`, the model could be used to recover part or all of it. We recommend restricting allowed tools (e.g. `claude_args: '--allowedTools "Bash(gh issue view:*)"'`) to the minimum required when using `allowed_non_write_users`.
1919
- **Token Permissions**: The GitHub app receives only a short-lived token scoped specifically to the repository it's operating in
2020
- **No Cross-Repository Access**: Each action invocation is limited to the repository where it was triggered
2121
- **Limited Scope**: The token cannot access other repositories or perform actions beyond the configured permissions

0 commit comments

Comments
 (0)