Skip to content

debug_dump writes raw MessagePart::Image base64 bytes to disk #6306

Description

@bug-ops

Description

debug_dump/mod.rs (around lines 622-629) serializes the outbound LLM request, sourced from unstripped self.msg.messages, including any MessagePart::Image — writing raw base64 image bytes to the debug dump file on disk. Found during review of #6239 (P1 ephemeral persistence strip for MCP image passthrough).

This is correctly out of scope for #6239/spec-072 §4 C1 — debug dumps are opt-in, off by default, and dumping the exact wire payload (including images) is the feature's stated purpose (compare to spec-072's invariant C4, which concerns logs/panics, not deliberately-enabled debug dumps). Filing as a standalone awareness/hardening item, not a spec-072 violation.

Reproduction Steps

  1. Enable debug dumps (raw format) per .local/testing conventions.
  2. Send a message containing an image (existing user-upload path).
  3. Inspect the debug dump file — expect the full base64-encoded image payload present in the dumped request JSON.

Expected Behavior

Open question for triage: either (a) accept as intended behavior (debug dumps are explicitly for wire-payload debugging and require opt-in), documented explicitly in the debug-dump docs/CLAUDE.md, or (b) redact/truncate large binary Image payloads by default with a separate opt-in flag to include full bytes.

Actual Behavior

Full base64 image bytes are written to the debug dump file whenever debug dumps are enabled and an image is present in the request.

Environment

Related

Suggested next step

Triage: confirm whether this is intended behavior (opt-in debug tooling) or needs redaction. If redaction is chosen, a small follow-up PR truncating/omitting MessagePart::Image base64 payloads in the debug-dump serializer, with a size marker instead.

Metadata

Metadata

Assignees

Labels

P3Research — medium-high complexitysecuritySecurity-related issue

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions