Skip to content

CM-77676: Scan the text in image files an agent reads - #598

Open
Altruistus wants to merge 2 commits into
mainfrom
CM-77676-ocr-scan-images-agents-read-with-file-read-tool
Open

Altruistus wants to merge 2 commits into
mainfrom
CM-77676-ocr-scan-images-agents-read-with-file-read-tool

Conversation

@Altruistus

@Altruistus Altruistus commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

TL;DR

When an agent opened a screenshot with its file-read tool, the hook sent the image as text, so a secret shown in it was never found. PNG and JPEG files are now sent as images, the way a prompt's attached images are, for Claude Code, Cursor and GitHub Copilot.

Why

The Secret in file read guardrail should catch a secret in an image the agent opens, not only in text files. The server decides whether to read images, so the client always sends them.

Reviewer notes

  • Same filters as prompt images: a regular file, PNG or JPEG by content, at most 5 MB. A file whose name lacks the right extension gets it added (Screenshot is sent as Screenshot.jpg), because the server also picks images by extension.
  • Everything else is still sent as text: text files named .png, GIFs, images over 5 MB. Images go past secrets.max_bytes up to 5 MB, as prompt images do.
  • The block message names the image, since a line and a masked value inside an image mean nothing to the developer.
  • Live-checked: Claude Code and Cursor fire their read hooks for images. GitHub Copilot isn't verified yet. Codex has no file-read hook.
  • Release only after the server side is live in every region.

Jira

CM-77676

🤖 Generated with Claude Code

Altruistus and others added 2 commits November 19, 2026 12:47
A PNG or JPEG file an agent reads with its file-read tool is sent as its
bytes, under a name with its format's extension, so the server reads the
text in it, as it does for the images attached to a prompt. Any other
file is still sent as text. One change in the shared file-read handler
covers Claude Code, Cursor and GitHub Copilot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants