anthropics / anthropics/claude-code-action

`/install-github-app` and `docs/usage.md` examples lack `author_association` guard — self-trigger loop and denial-of-wallet exposure at scale

オープン
#1,481 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
area:installation area:permissions bug documentation p2
主要言語
TypeScript
スター
8.9k
フォーク
2.1k
平均マージ
3日 9時間
マージ済み PR(30日)
10

説明

### Problem

The workflow generated by `/install-github-app` and the example in [`docs/usage.md`](https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md) do not include an `author_association` filter or a `sender.type != 'Bot'` guard in the `if:` condition. This causes two issues:

1. **Self-trigger loop :** The agent's reply comment can contain `@claude`, re-triggering the workflow indefinitely.

2. **Denial-of-wallet surface:** On public repos, any user can comment `@claude` to trigger the workflow. The action's internal `checkWritePermissions` gate (in [`src/github/validation/permissions.ts`](https://github.com/anthropics/claude-code-action/blob/main/src/github/validation/permissions.ts)) blocks non-collaborators from write actions, but the workflow still runs and may consume API tokens before that gate fires at the tool-execution layer.

### Current pattern (from `docs/usage.md`)

The [`docs/usage.md`](https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md) example does not even include an `if:` condition:

```yaml
name: Claude Assistant
on:
issue_comment:
types: [created]
jobs:
claude-response:
runs-on: ubuntu-latest
steps:
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
```

The `/install-github-app` generated workflow adds a content check but no actor filter:

```yaml
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || ...
```

### Suggested addition

```yaml
if: |
contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association) &&
github.event.sender.type != 'Bot' &&
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || ...
```

This prevents both self-trigger loops (bot comments are excluded) and non-collaborator triggers (only OWNER/MEMBER/COLLABORATOR can invoke).

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start with docs/usage.md and trace the /install-github-app entry point to the generated workflow source. Compare both workflow conditions with the permissions check in src/github/validation/permissions.ts, then verify that authorized human comments can trigger while bot and non-collaborator comments cannot. Done means both the documentation example and generated workflow include the intended guards.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
github-actions, typescript
領域
ci-cd, documentation, security
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
68/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。