anthropics / anthropics/claude-code-action

claude-user-request.txt is written from the unsanitized trigger comment, so hidden content bypasses sanitizeContent

オープン
#1,779 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug p2
主要言語
TypeScript
スター
8.9k
フォーク
2.1k
PR マージ指標
PR 指標を取得中

説明

**Type:** bug / prompt-injection hardening
**Severity:** medium-high
**Area:** `src/create-prompt/index.ts`, consumed by `base-action/src/run-claude-sdk.ts`
**Effort:** small

## Summary

The prompt wraps the trigger comment in `sanitizeContent` (`src/create-prompt/index.ts` around lines 577 and 710) and tells the model that block is the only source of instructions. But `extractUserRequestFromContext` (around lines 910-918) runs `extractUserRequest` on the **raw** `eventData.commentBody` / `githubData.contextData.body`, and the result is written unsanitized to `claude-user-request.txt` (around lines 973-978). `base-action/src/run-claude-sdk.ts` (around lines 45-83) then sends that file as a second `text` block of the same user message.

So everything `docs/security.md` says is stripped (HTML comments, invisible characters, image alt text, hidden attributes) reaches the model anyway through the second block. `allowed_non_write_users` explicitly supports untrusted trigger authors.

## Reproduction

Trigger comment:

```
@claude summarize this issue please ![ALT-TEXT-PAYLOAD](https://github.com/user-attachments/assets/x) ok
```

Running the real `createPrompt` with `RUNNER_TEMP` pointed at a scratch directory:

```
trigger_comment block in claude-prompt.txt (sanitized):
"@claude summarize this issue please ![](https://github.com/user-attachments/assets/x) ok"
claude-user-request.txt (2nd content block):
"summarize this issue please ![ALT-TEXT-PAYLOAD](...) ok"
```

Every marker (`

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

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

評価

この issue はまだ評価されていません。

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

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