Skip to content

BUG: Baggage.from_incoming_header silently drops sentry items when baggage values contain '=' characters #6449

Description

@devteamaegis

When a W3C baggage header contains sentry items whose values include = characters — which is legal per the spec, e.g. base64-encoded strings like v1.0==1Baggage.from_incoming_header silently discards those items.

The root cause is key, val = item.split("=") on line 722 of sentry_sdk/tracing_utils.py. Without a maxsplit argument, any value containing = causes split to return more than two parts, raising ValueError: too many values to unpack. This exception is swallowed by the surrounding capture_internal_exceptions() context manager, so the affected baggage item is silently dropped from sentry_items.

For example, the header sentry-release=v1.0==1,sentry-trace_id=abc123 produces {'trace_id': 'abc123'} instead of {'release': 'v1.0==1', 'trace_id': 'abc123'}.

To reproduce, run: python3 -c "from sentry_sdk.tracing_utils import Baggage; b = Baggage.from_incoming_header('sentry-release=v1.0==1,sentry-trace_id=abc123'); assert b.sentry_items == {'release': 'v1.0==1', 'trace_id': 'abc123'}, b.sentry_items"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions