Skip to content

fix(redact): preserve Codex input_image payloads during JSONL redaction - #2066

Open
suhaanthayyil wants to merge 11 commits into
mainfrom
fix/track-2060
Open

fix(redact): preserve Codex input_image payloads during JSONL redaction#2066
suhaanthayyil wants to merge 11 commits into
mainfrom
fix/track-2060

Conversation

@suhaanthayyil

@suhaanthayyil suhaanthayyil commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Trail: https://entire.io/gh/entireio/cli/trails/1097

What: Skip Codex input_image / output_image JSONL objects during entropy redaction so base64 image payloads are not rewritten to REDACTED.

Why / how it helps: Codex embeds images as type:input_image, which did not match HasPrefix(t, "image"). Subagent transcripts (and main sessions with externalization off) silently lost image bytes.

How: Extend shouldSkipJSONLObject to also match types with an _image suffix; add round-trip tests for Codex and Claude shapes.

Testing:

  • go test ./redact/ -count=1 green (includes new Codex/Claude image cases)
  • gofmt clean on committed tree

Fixes #2060

shouldSkipJSONLObject only matched strings.HasPrefix(t, "image") or
t == "base64" to identify image objects safe to skip during JSONL
redaction. Codex embeds images as "type":"input_image", which matches
neither check, so the entropy scanner treated the base64 payload as a
high-entropy secret and silently rewrote it to REDACTED — corrupting
the image with no error surfaced. Claude's "type":"image" already
matched via the prefix check and was unaffected.

Extend the check to also match any "..._image" suffix (covers
input_image and output_image) so Codex transcripts round-trip through
JSONLBytes without base64 corruption, while Claude's image type keeps
working as before.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes JSONL redaction behavior so Codex inline image payload objects (e.g., {"type":"input_image", ...} / {"type":"output_image", ...}) are treated like other image-bearing JSON objects and are skipped during entropy redaction, preventing high-entropy base64 image data from being rewritten to REDACTED. This aligns redaction behavior with how multiple agent transcript formats encode images and preserves data needed for replay/export.

Changes:

  • Extend shouldSkipJSONLObject to skip JSON objects whose "type" ends with _image (e.g., input_image, output_image), in addition to existing image* and base64 handling.
  • Add regression tests ensuring JSONLBytes preserves Codex input_image data URL payloads and still preserves Claude-style type:"image" objects.
  • Expand TestShouldSkipJSONLObject coverage to include input_image and output_image.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
redact/redact.go Expands image-object detection to include Codex _image-suffixed types so image payloads aren’t corrupted by entropy redaction.
redact/redact_test.go Adds regression tests for Codex and Claude image JSONL shapes and extends unit coverage for _image types.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@suhaanthayyil
suhaanthayyil marked this pull request as ready for review August 19, 2026 18:07
@suhaanthayyil
suhaanthayyil requested a review from a team as a code owner August 19, 2026 18:07
suhaanthayyil and others added 10 commits August 19, 2026 14:51
The suffix check matched any type name ending in "_image" (e.g.
docker_image, container_image), which would silently skip redaction
of an unrelated object that happens to carry a secret in another
field. Match only the known Codex screenshot types (input_image,
output_image) by exact equality.

Co-authored-by: Cursor <cursoragent@cursor.com>
Entire-Checkpoint: 01M0DS8PQK39EWWPC2KKPJKFEV
Co-authored-by: Cursor <cursoragent@cursor.com>
Entire-Checkpoint: 01M0X8J060NZ2PE67QVKTY41MA
Co-authored-by: Cursor <cursoragent@cursor.com>
Entire-Checkpoint: 01M0X9BWQGFEBZDZ978XV322NA
Co-authored-by: Cursor <cursoragent@cursor.com>
Entire-Checkpoint: 01M0XBEHHF31CNJPXBJN7ZDZP2
Co-authored-by: Cursor <cursoragent@cursor.com>
Entire-Checkpoint: 01M0XC928NZFZJ1SWXMXTK3MMG
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Codex input_image base64 silently destroyed by JSONL redaction

2 participants