Skip to content

fix(observability): avoid embedding raw base64 image payloads in span attributes #69

@coderabbitai

Description

@coderabbitai

Problem

In src/proxy/handlers/messages/span_attributes/message_attributes.rs, the function image_source_to_data_url currently constructs a full data:<media_type>;base64,<data> URI for ImageSource entries with type "base64". This value is propagated into gen_ai.* message JSON and OpenInference message content span properties.

This has two risks:

  1. Span size limits — A single inline image can easily exceed span size limits in observability backends (e.g., Jaeger, OTLP collectors), causing spans to be dropped or truncated.
  2. Data leakage — Full image payloads are recorded verbatim into telemetry, which may not be appropriate.

Expected Behaviour

image_source_to_data_url (and any callers) should record metadata only — e.g., media_type plus either the byte length or a short checksum/hash of source.data, or a sentinel like "inline-base64-omitted". Non-base64 sources (url type) should continue to return source.data unchanged. Downstream consumers (content_parts_from_blocks, stream output collector, etc.) should be updated to handle the metadata token.

References

/cc @bzp2010

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions