-
Notifications
You must be signed in to change notification settings - Fork 107
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
otel_propagator doesn't escape values #225
Comments
I think it might be restricted to not allow commas. But means we need to drop that pair. So either way the current functionality is wrong :) https://w3c.github.io/baggage/#definition |
Yea, both key and value can't have separators in them. |
Oh, nm, values are url encoded (but seems keys aren't). |
The spec strikes me as a little loose. I reckon implementations MUST escape commas, semicolons, and equals signs in the keys and values because the alternatives are clearly worse: crashing, dropping keys and values, or corrupting the values for other keys. How do we push that along? Surely they'll at least go for a SHOULD. In Elixir you can augment the determination of which characters are URI-escaped with the second argument to iex(21)> URI.encode("x=foo,bar;\"", & (&1 not in [?,, ?=, ?;]) and URI.char_unescaped?(&1))
"x%3Dfoo%2Cbar%3B%22" |
Pretty sure they (the key/value pair or the whole thing if its in the process of being parsed from a header) just get dropped because they aren't allowed. |
Yeah, I'd opt for a simple regex and just drop if it fails for performance reasons. |
I find silent failure eg. dropping values we don't like makes for frustrating troubleshooting. The spec demands we encode anyway, and adding an extra regular expression check surely can't make it faster. URI encoding the delimiters as well as (say) backslashes is a cheap and easy fix, no? Anyhow if you could upgrade from "yeah nah" to "yeah ok I guess", to use the Aussie expressions, I'd very much appreciate it. |
Checked the spec again, and I'm:
Lucky for us, tokens permit
For dropping bad keys only, is there an Erlang equivalent to the Elixir community habit of compiling in warnings for dev and test, but not for prod? Then we could at least tell them why their Phoenix style nested keys with square brackets disappeared. |
For values, right, we agree there. I think we need to send a patch to OTP that includes the new function we'll have to be added into Otel to do this. I think
Ideally I think And I think it should be named |
And I don't know of a pattern for that logging stuff in Erlang. I was going to say we could add a define |
Did some more digging and
So it just needs to export the And for now we'll just vendor in that function. |
Great find! |
If you are referring to for baggage, But... hm, now that I think about it (after doing the work of vendoring in the encode function and using it, hehe) we could turn the value into the value+metadata and then use |
Oh, I'm just grabbing for whatever code I can get for free. There'll always be more work, eg. appending the metadata block when encoding, and trimming the optional white space (OWS) around keys¹ and values² when decoding. Unless we write something 100% custom, but I think I'd rather spend the time elsewhere. ¹ https://w3c.github.io/baggage/#key |
So, nm, can't use |
Yeah, nah, we'd need to append the |
@garthk just realized I was being stupid, for logs we don't want in production we simply use the |
Closing now that #233 is merged. But I think we need a new issue about a) adding |
This strikes me as dangerous:
It might also be a little too trusting about keys. I imagine shoving JSON into a baggage value will get messy.
(I previously raised binaries turning into charlists in #224.)
The text was updated successfully, but these errors were encountered: