anthropics / anthropics/claude-code

[BUG] Image markdown is silently rewritten in GitHub comments posted from cloud sessions

Đang mở
#89,540 1 bình luận 1 reaction 0 người được giao Xem trên GitHub
area:claude-code-web area:security bug platform:web
Ngôn ngữ chính
Python
Star
145k
Fork
23.1k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

### Preflight Checklist

- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code

### What's Wrong?

When Claude posts a GitHub issue or PR comment from a Claude Code on the web cloud session, every image embed in the body is rewritten before it reaches GitHub:

| Sent | Stored by GitHub |
| --- | --- |
| `![alt](url)` | `[alt](url)` — leading `!` stripped, becomes a plain link |
| `[![alt](url)](target)` | `[[alt](url)](target)` — `!` stripped, leaves a broken nested link |
| `` | `` `<img src="url" width="300">` `` — HTML-escaped and wrapped in a code span |

**This happens silently.** The API call returns `201 Created`, the tool result reports success, and nothing in the response indicates the body was modified. It is only detectable by reading the comment back and diffing it against what was sent.

Note that this is not about uploading images to github, but rather linking images uploaded to other places (cloudflare R2 in my case) in github comments.

### What Should Happen?

Image markdown should be passed through unmodified. If this is intentional behavior then this should be clarified in some way, better to throw an error and let users know that image markdown is not allowed and at the very least document it somewhere.

However I would argue if this sanitation is specifically designed to prevent embedding images in markdown then it is overzealous - having the agent add images to PRs is essential for fast PR reviews and to my knowledge there is no serious threat model where showing images would result in malicious behaviors for visitors or where showing images that were already uploaded somewhere else would expand malicious extraction of information (I.E. the agent already uploaded the images somewhere else, linking to it in github is not going to increase the threat)

### Error Messages/Logs

```shell

```

### Steps to Reproduce

From a Claude Code on the web cloud session, against any repository you can comment on:

1. Post a comment containing an image embed:

```sh
gh api repos/OWNER/REPO/issues/1/comments \
-f body='![icon](https://claude.ai/images/claude_app_icon.png)'
```

2. Read back what GitHub actually stored:

```sh
gh api repos/OWNER/REPO/issues/1/comments --jq '.[-1].body'
```

3. Compare:

```
Expected: ![icon](https://claude.ai/images/claude_app_icon.png)
Actual: [icon](https://claude.ai/images/claude_app_icon.png)
```

The `` variant, for completeness:

```sh
gh api repos/OWNER/REPO/issues/1/comments \
-f body=''
```

```
Expected:
Actual: `<img src="https://claude.ai/images/claude_app_icon.png" width="200">`
```

Both also reproduce via the GitHub MCP server's `add_issue_comment` tool with the same body, producing byte-identical output.

### Claude Model

Opus

### Is this a regression?

I don't know

### Last Working Version

_No response_

### Claude Code Version

2.1.243

### Platform

Anthropic API

### Operating System

Other

### Terminal/Shell

Other

### Additional Information

_No response_

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

No repository files or tests are named. Reproduce the behavior with the supplied gh api commands, compare the sent and stored bodies, then trace the cloud-session GitHub comment path and the MCP add_issue_comment entry point; done when image markdown is preserved or the behavior is explicitly rejected and documented.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
github
Lĩnh vực
api, cloud
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.