Excessive memory allocation while parsing OpenTelemetry Go baggage headers (GO-2026-6975)

Excessive memory allocation while parsing OpenTelemetry Go baggage headers (GO-2026-6975)

Description

In go.opentelemetry.io/otel from v1.0.0-RC1 up to but excluding v1.47.0, baggage.Parse allocates objects up front for the properties in a W3C Baggage header. A header with many properties can cause disproportionate allocation even within the header size limit. propagation.Baggage.Extract uses the same parser.

Potential impact

Concurrent requests to a service that processes incoming baggage headers can increase allocation and garbage collection work, slowing responses.

Remediation

Update go.opentelemetry.io/otel to v1.47.0 or later. The fixed parser validates properties while parsing the header and creates the objects when the application reads those properties.

Examples

Update the dependency declaration in go.mod.

Before

go
require go.opentelemetry.io/otel v1.46.0

After

go
require go.opentelemetry.io/otel v1.47.0

References