Repository navigation
CM-78367: Scan images attached to Codex prompts for secrets - #593
Merged
Altruistus merged 3 commits intoNov 17, 2026
Conversation
Codex's prompt hook gets the prompt text only, with an [Image #N] chip per attached image. The terminal UI saves an image pasted from the clipboard as codex-clipboard-<random>.png in the temp directory and keeps it. The hook now sends the newest pastes of the last hour that no earlier prompt of the session sent (read from its transcript), one per chip, plus @path mentions, with the prompt text in one scan. Codex records a prompt only after its hook lets it through, so a blocked prompt sent again is scanned again. Images dragged in, picked from the @ popup or passed with --image, and the VS Code extension's attachments, are not named anywhere the hook can read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 17, 2026
Codex sends a second prompt to title a new thread. It has no transcript and quotes the user's prompt, chips included, so it took the paste the user's prompt had just sent and scanned it again. Without a transcript nothing tells a sent paste from an unsent one, so no paste is taken. The docstring also says what a live run showed: a dragged image, or one picked from the @ popup, gets a chip but no paste, so the prompt takes the newest unsent paste in its place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Altruistus
merged commit Nov 17, 2026
23ba3f3
into
CM-78366-block-secrets-in-images-claude-code
10 checks passed
Altruistus
added a commit
that referenced
this pull request
Nov 18, 2026
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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
A secret in a screenshot pasted into Codex goes to the model unscanned, because the prompt hook only scans the prompt's text. The Codex prompt hook now finds the clipboard images pasted into the prompt and scans them with the text in one scan.
Why
The Secret in prompt guardrail should block or report a secret whether it is typed or shown in an attached image. Codex's
UserPromptSubmitpayload has the prompt text only. It has an[Image #N]chip for each attached image, but no path. The terminal UI saves a clipboard paste ascodex-clipboard-<random>.pngin the temp directory and keeps the file, so those pastes can be found.Reviewer notes
rust-v0.160.1), checked again on 0.169.0, and live terminal-UI runs on 0.169.0:[Image #N]placeholder in the text, so a pasted image alone arrives as[Image #1], not an empty prompt.<image name=[Image #k] path="…">in the transcript.@pathmentions.@popup. In a live run a dragged or picked image got a chip but no paste, so the prompt took the newest unsent paste of the last hour in its place. Two Codex sessions pasting at the same time can also see each other's pastes. Accepted as rare: it needs an unsent paste from the last hour, and the dragged or picked image itself is a known gap.@popup, or passed with--image/-i: the original file is attached and nothing names it;Tests:
pytest tests1534 passed, 1 skipped. New Codex cases cover the newest paste per chip, pastes already sent, no chip, a repeated chip, old pastes, no transcript, a transcript not written yet, and mentions.ruffis clean.Jira
CM-78367
🤖 Generated with Claude Code