-
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
Error while parsing Baggage header with percent-encoded whitespace #3601
Comments
This was referenced Jan 30, 2023
After looking into this a bit more, I believe here are some issues with the current implementation:
This is our take on fixing these issues: getsentry/sentry-go#568 |
n-oden
added a commit
to odenio/opentelemetry-go
that referenced
this issue
Oct 24, 2023
I believe this addresses the majority of the cases described in open-telemetry#3601 Golang's url.QueryUnescape will render url _path_ elements (e.g. /, +) as spaces: `foo+bar` is rendered as `foo bar`. Path elements are (as I read the spec) legal W3C baggage values, and replacing them with spaces fails the value validation regex. url.PathEscape allows path elements through unmolested. Signed-off-by: Nathan J. Mehl <[email protected]>
n-oden
added a commit
to odenio/opentelemetry-go
that referenced
this issue
Oct 24, 2023
I believe this addresses the majority of the cases described in open-telemetry#3601 Golang's url.QueryUnescape will render url _path_ elements (e.g. /, +) as spaces: `foo+bar` is rendered as `foo bar`. Path elements are (as I read the spec) legal W3C baggage values, and replacing them with spaces fails the value validation regex. url.PathEscape allows path elements through unmolested. Signed-off-by: Nathan J. Mehl <[email protected]>
MrAlias
pushed a commit
that referenced
this issue
Oct 31, 2023
…#4667) * Use url.PathUnescape rather than url.QueryUnescape I believe this addresses the majority of the cases described in #3601 Golang's url.QueryUnescape will render url _path_ elements (e.g. /, +) as spaces: `foo+bar` is rendered as `foo bar`. Path elements are (as I read the spec) legal W3C baggage values, and replacing them with spaces fails the value validation regex. url.PathEscape allows path elements through unmolested. Signed-off-by: Nathan J. Mehl <[email protected]> * Update CHANGELOG.md address comments Co-authored-by: Robert Pająk <[email protected]> --------- Signed-off-by: Nathan J. Mehl <[email protected]> Co-authored-by: Robert Pająk <[email protected]>
@tonyo Can you please double-check if releases starting from https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.20.0 are solving the issue you described? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
At the moment
baggage.Parse
fails when trying to decode a value with percent-encoded whitespace "%20" (and potentially others?).Related issue in "opentelemetry-python" that has a pending fix: open-telemetry/opentelemetry-python#2934
A test case in "opentelemetry-js" that hints that whitespaces should be properly handled when encoding and decoding baggage: https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-core/test/baggage/W3CBaggagePropagator.test.ts#L60
Might be also related to #3467.
Environment
Steps To Reproduce
The following code returns the error:
invalid value: "val1 val2"
https://go.dev/play/p/2kLO3RFzH_R
Expected behavior
key1=val1%20val2
should be properly parsed into a baggage item with key "key1" and value "val1 val2" (at least that's my understanding).The text was updated successfully, but these errors were encountered: