Repository navigation
CM-77676: Scan the text in image files an agent reads - #598
Open
Altruistus wants to merge 2 commits into
Open
Altruistus wants to merge 2 commits into
Altruistus wants to merge 2 commits into
Conversation
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>
Ilanlido
approved these changes
Nov 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Screenshotis sent asScreenshot.jpg), because the server also picks images by extension..png, GIFs, images over 5 MB. Images go pastsecrets.max_bytesup to 5 MB, as prompt images do.Jira
CM-77676
🤖 Generated with Claude Code