You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
W3CBaggagePropagator uses java.net.URLDecoder to decode baggage values which may be percent-encoded as per https://w3c.github.io/baggage/#definition
Looking at that specification, the + character is a valid character. However, URLDecoder transforms it to a space character. In particular, this change corrupts baggage values that are Base64 encoded.
encodedInBase64 and fooValue should be the same string. Furthermore, Base64.getDecoder().decode(fooValue) should not fail.
What did you see instead? fooValue as a space where encodedInBase64 has as a + character. Base64.getDecoder().decode(fooValue); throws a java.lang.IllegalArgumentException: Illegal base64 character 20
I'm looking into it, and it looks like a custom decoder has to be written, since the URLDecoder uses a different set of characters than the specification.
Describe the bug
W3CBaggagePropagator
usesjava.net.URLDecoder
to decode baggage values which may be percent-encoded as per https://w3c.github.io/baggage/#definitionLooking at that specification, the
+
character is a valid character. However,URLDecoder
transforms it to a spaceSteps to reproduce
What did you expect to see?
encodedInBase64
andfooValue
should be the same string. Furthermore,Base64.getDecoder().decode(fooValue)
should not fail.What did you see instead?
fooValue
as a space whereencodedInBase64
has as a+
character.Base64.getDecoder().decode(fooValue);
throws ajava.lang.IllegalArgumentException: Illegal base64 character 20
What version and what artifacts are you using?
Environment
Compiler: (e.g., "JDK 18.0.2")
OS: (e.g., "Mac OS Monterey")
The text was updated successfully, but these errors were encountered: