Skip to content

fix(core): redact image bytes from debug dumps by default - #6314

Merged
bug-ops merged 1 commit into
mainfrom
fix/6306-debug-dump-image-redact
Jul 16, 2026
Merged

fix(core): redact image bytes from debug dumps by default#6314
bug-ops merged 1 commit into
mainfrom
fix/6306-debug-dump-image-redact

Conversation

@bug-ops

@bug-ops bug-ops commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • debug_dump/mod.rs serialized outbound LLM requests verbatim, including MessagePart::Image base64 payloads, in both json and raw dump formats. The raw format's dominant path clones the provider's native wire payload directly, so Claude/OpenAI/Gemini/Ollama vision requests all leaked full image bytes to disk whenever debug dumps were enabled ([debug] enabled = true, opt-in feature).
  • All known image-payload shapes (internal typed form, Claude, OpenAI, Gemini, Ollama) are now redacted to a <redacted image: {mime_type}, {n} bytes, blake3:{prefix}> marker via a single generic recursive JSON-value redactor applied to both dump formats.
  • Added an opt-in [debug] include_raw_images config flag (default false) to restore full raw byte output for wire-payload debugging; enabling it now emits a tracing::warn! at construction time so the tradeoff is visible in logs.

Notes

  • Scope is intentionally bounded to MessagePart::Image in outbound requests. Other sensitive text content in messages (PII, secrets) is unaffected by this change, and dump_tool_output/dump_response have a related but out-of-scope residual leak vector (raw tool output text, e.g. a vision tool returning base64 as text) — filing a follow-up issue for that.
  • Adversarial review (impl-critic) flagged that the initial test suite was self-referential (hand-authored JSON matching the redactor's own shape assumptions, fail-open risk if a provider's wire shape drifts). Addressed with a regression test that drives the actual ClaudeProvider/OpenAiProvider/GeminiProvider/OllamaProvider serializers from zeph-llm with an image-bearing message and asserts no raw base64 survives the real dump_request/raw_dump path.
  • OpenAI's Responses API input_image string shape (a known future leak vector) is not wired up anywhere in this codebase today — no dead-code test added; documented in the playbook.

Closes #6306

Test plan

  • cargo +nightly fmt --check — clean
  • cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings — clean
  • cargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins — 13802 passed, 0 failed, 35 skipped
  • RUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler" — clean
  • gitleaks protect --staged --no-banner --redact — no leaks
  • New regression test drives real provider serializers (Claude/OpenAI/Gemini/Ollama) and asserts redaction on actual wire-format JSON, not hand-authored fixtures
  • Live-session verification against a real vision-capable provider — not yet exercised with a live API key; tracked as Untested in .local/testing/coverage-status.md

@github-actions github-actions Bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate config Configuration file changes bug Something isn't working size/XL Extra large PR (500+ lines) labels Jul 16, 2026
debug_dump/mod.rs serialized outbound LLM requests verbatim, including
MessagePart::Image base64 payloads, in both json and raw dump formats.
The raw format's dominant path clones the provider's native wire
payload directly, so Claude/OpenAI/Gemini/Ollama vision requests all
leaked full image bytes to disk whenever debug dumps were enabled.

Redact all known image-payload shapes to a size/format marker by
default; add an opt-in include_raw_images config flag to restore full
byte output for wire-payload debugging, with a startup warning when
enabled.

Closes #6306
@bug-ops
bug-ops enabled auto-merge (squash) July 16, 2026 17:05
@bug-ops
bug-ops force-pushed the fix/6306-debug-dump-image-redact branch from e8c9101 to d939cfe Compare July 16, 2026 17:05
@bug-ops
bug-ops merged commit cb1b3a8 into main Jul 16, 2026
47 checks passed
@bug-ops
bug-ops deleted the fix/6306-debug-dump-image-redact branch July 16, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working config Configuration file changes core zeph-core crate documentation Improvements or additions to documentation rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

debug_dump writes raw MessagePart::Image base64 bytes to disk

1 participant