Skip to content

When a Sentry-Trace header is sent erroneously multiple times #6703

Description

@wmak

How do you use Sentry?

Sentry Saas (sentry.io)

Version

latest

Steps to Reproduce

  1. Set the sentry-trace header when already in a transaction to a python server
  2. The set header will then be read by the server into something like: Sentry-Trace:efa64e95faf54da59b81cce3fb159825-b8efba9273e7a14f-1,efa64e95faf54da59b81cce3fb159825-b8ffba9273e7a14f-1
  3. Then when the sdk tries to parse this to get the trace_id it fails

Expected Result

The SDK shouldn't fail to parse the header, and instead should probably(?) just pull the first one or one at random

Actual Result

The regex here

SENTRY_TRACE_REGEX = re.compile(
"^[ \t]*" # whitespace
"([0-9a-f]{32})?" # trace_id
"-?([0-9a-f]{16})?" # span_id
"-?([01])?" # sampled
"[ \t]*$" # whitespace
)
fails to parse since the header value now contains a comma unexpectedly

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions