…ming_header (getsentry#6450)
## What's broken
`Baggage.from_incoming_header` silently drops any sentry baggage item
whose value contains an `=` character (e.g. base64-encoded strings like
`v1.0==1`). A header like
`sentry-release=v1.0==1,sentry-trace_id=abc123` produces `{'trace_id':
'abc123'}` instead of `{'release': 'v1.0==1', 'trace_id': 'abc123'}`.
## Why it happens
`key, val = item.split("=")` without a `maxsplit` argument raises
`ValueError: too many values to unpack` when the value contains `=`. The
surrounding `capture_internal_exceptions()` swallows the exception,
silently discarding the item.
## Fix
Changed `item.split("=")` to `item.split("=", 1)` so the split stops
after the first delimiter, correctly assigning the key and the full
value (including any `=` in the value).
## Test
Added `test_baggage_from_incoming_header_value_with_equals_sign` which
parses a header containing a sentry item with `==` in its value and
asserts both items are present in `sentry_items`.
Fixes getsentry#6449
Co-authored-by: Aegis Dev <devteamaegis@users.noreply.github.com>
Co-authored-by: Ivana Kellyer <ivana.kellyer@sentry.io>
What's broken
Baggage.from_incoming_header silently drops any sentry baggage item whose value contains an = character (e.g. base64-encoded strings like v1.0==1). A header like sentry-release=v1.0==1,sentry-trace_id=abc123 produces {'trace_id': 'abc123'} instead of {'release': 'v1.0==1', 'trace_id': 'abc123'}.
Why it happens
key, val = item.split("=") without a maxsplit argument raises ValueError: too many values to unpack when the value contains =. The surrounding capture_internal_exceptions() swallows the exception, silently discarding the item.
Fix
Changed item.split("=") to item.split("=", 1) so the split stops after the first delimiter, correctly assigning the key and the full value (including any = in the value).
Test
Added test_baggage_from_incoming_header_value_with_equals_sign which parses a header containing a sentry item with == in its value and asserts both items are present in sentry_items.
Fixes #6449