-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected Baggage Value Modification Due to Potential Skipped Escaping. #5840
Comments
OTel Go implementation is compliant with the baggage specification. See https://www.w3.org/TR/baggage/#value
Actually, it looks like there is a bug in OTel Java. It should probably encode the baggage as Notice that https://pkg.go.dev/go.opentelemetry.io/otel/baggage#NewMemberRaw accepts any valid UTF-8 string. You are mixing the "propagation" layer (which has to be encoded and decoded) with the OpenTelemetry API layer. |
@pellared Thanks for your reply!
I believe there may be some misunderstanding here, so let me try to elaborate:
I understand that the "propagation" layer extracts baggage from the carrier as opentelemetry-go/propagation/baggage.go Line 24 in f710cec
opentelemetry-go/propagation/baggage.go Line 37 in f710cec
I believe this is the theme of this issue: the content of the baggage is not consistent before decoding and after encoding, even though we haven’t modified it using any APIs during the process. |
|
Hello everyone,
In our application system, we use baggage to carry various requests-related tags. We deploy a sidecar outside of the application process to intercept outgoing requests and parse these tags, allowing us to dispatch requests based on the tag values. For this purpose, we integrate the
opentelemetry-go
with W3C Baggage Propagator in our applications to handle the extraction and injection of baggage.This system has been functioning smoothly until we introduced a baggage value that contains the
=
character (encoded as%3D
). While this value is properly decoded when requests enter the application, it's not being re-encoded back to%3D
when requests are sent downstream with the baggage.For example, the request sent to the application is:
But the request sent by the application is:
Upon a detailed examination of the code, we believe the issue stems from a few lines that prevent the propagator from encoding the
=
character back to%3D
during the injection process.opentelemetry-go/baggage/baggage.go
Lines 1012 to 1018 in 6731dc7
Previously, we also integrated the
opentelemetry-java
implementation, which has worked exceptionally well for Java applications.https://github.com/open-telemetry/opentelemetry-java/blame/fa826fdef07167b22089b96b957749e9f41e72e2/api/all/src/main/java/io/opentelemetry/api/internal/PercentEscaper.java#L72-L78
Although we can modify our sidecar as a workaround, we believe that the OpenTelemetry SDK should ensure the accurate transmission of baggage, rather than making any passive changes during the application's processing. This is to ensure that what is retrieved matches what is set, as stated in the OpenTelemetry spec——Language API MUST accept any valid UTF-8 string as baggage value in
Set
and return the same value fromGet
.Thank you for your attention to this issue!
The text was updated successfully, but these errors were encountered: