-
Notifications
You must be signed in to change notification settings - Fork 579
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
Add WithoutSubSpans option to NewClientTrace #879
Add WithoutSubSpans option to NewClientTrace #879
Conversation
7ac081e
to
ce76e05
Compare
value := sliceToString(v) | ||
if _, ok := ct.redactedHeaders[k]; ok { | ||
// redact all non-space runes to 'x' | ||
value = strings.Map(func(r rune) rune { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer if this wouldn't leak the length/spaces or waste space with long tokens. Just constant ***
sgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have even a stronger point of view. I think in such a case, the attribute should NOT be included at all. This is to ensure we do not leak any security-related internals.
Reasoning: open-telemetry/opentelemetry-specification#1502 (comment)
This would be also more in line with other specification recommendations such us:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now I have updated to use fixed ****
value. We can instead drop those annotations completely, I dont really have a preference. If we drop them, I guess I would change the WithRedactedHeaders
to WithIgnoredHeaders
to alllow appending to the fixed list. We can also swap the default to not collect any headers unless a WithHeaders
option is specified. For the edge case of trying to debug authentication-related issues, we could add WithRedactgnoredHeaders
(or some such name) to keep headers in the spans but always hide the values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer the redacted value instead of ignoring one. Seeing which requests were authenticated and which were not is an important common feature in tracing HTTP traffic and can point to issues.
5801e3b
to
70ab82b
Compare
instrumentation/net/http/httptrace/otelhttptrace/clienttrace.go
Outdated
Show resolved
Hide resolved
2ceef5c
to
d757e2b
Compare
Codecov Report
@@ Coverage Diff @@
## main #879 +/- ##
=======================================
+ Coverage 69.2% 69.4% +0.1%
=======================================
Files 77 77
Lines 4850 4929 +79
=======================================
+ Hits 3359 3423 +64
- Misses 1353 1367 +14
- Partials 138 139 +1
|
I think this is not true b/c of the default Also is it possible to remove the default |
True, there is a behaviour change due to the redacted headers. I didn't know about the leaking headers when I opened the issue and made that comment.
We could add a |
d757e2b
to
cc0c21d
Compare
No response, so I went ahead and added |
a32efea
to
2188076
Compare
Updated lint issue that broke the tests, I forgot to run the precommit check but it is working now. |
instrumentation/net/http/httptrace/otelhttptrace/clienttrace.go
Outdated
Show resolved
Hide resolved
2188076
to
ea594c2
Compare
instrumentation/net/http/httptrace/otelhttptrace/clienttrace.go
Outdated
Show resolved
Hide resolved
instrumentation/net/http/httptrace/otelhttptrace/clienttrace_test.go
Outdated
Show resolved
Hide resolved
f87cd46
to
a0dc0a0
Compare
@coryb needs a rebase |
a0dc0a0
to
47dbbcc
Compare
Thanks for the ping, rebased, again. Hopefully we can get this merged in, please. |
bbf1e35
to
b8da8cd
Compare
Could someone please poke the workflow approval button so the test will run? |
Can we please get this merged in? We have two approvals and tests are passing ... what more is left? |
@coryb needs a rebase (again 😞) |
b8da8cd
to
81f719d
Compare
This adds an optional behavior to NewClientTrace so that it only adds events and annotations to the span found in SpanFromContext. The default behavior remains unchanged, several sub-spans will be created for each request. This optional behavior is useful when tracing "complex" processes that have many http calls. In this case the added sub-spans become "noise" and may distract from the overall trace. This also adds several useful attributes from data available in the httptrace callbacks: http.conn.reused - bool if connection was reused http.conn.wasidle - bool if connection was idle http.conn.idletime - if wasidle, duration of idletime http.conn.start.network - start connection network type [tcp/udp] http.conn.done.network - end connection network type [tcp/udp] http.conn.done.addr - connection address when done http.dns.addrs - list of addrs returned from dns lookup Signed-off-by: coryb <cbennett@netflix.com>
On testing we learned that sensitive information was being stored in the traces. To prevent the security leak several security or sensitive headers will now be redacted. These are the headers redacted by default: Authorization WWW-Authenticate Proxy-Authenticate Proxy-Authorization Cookie Set-Cookie Users can add more headers to redact with WithRedactedHeaders. To disable adding headers to the span entirely users can use WithoutHeaders. Signed-off-by: coryb <cbennett@netflix.com> Co-authored-by: Robert Pająk <pellared@hotmail.com>
81f719d
to
2756490
Compare
Hi folks, I have rebased again to address merge conflicts on the CHANGELOG. It has now been a month since the last change other than the rebases, so this is pretty frustrating. I need someone to poke the workflow approval button again. |
@pellared @Aneurysm9 are you able to help out to this PR moving? 🤗 |
Thanks! |
This adds an optional behavior to NewClientTrace so that it only
adds events and annotations to the span found in SpanFromContext.
The default behavior remains unchanged, several sub-spans will be
created for each request. This optional behavior is useful when
tracing "complex" processes that have many http calls. In this case
the added sub-spans become "noise" and may distract from the overall
trace.
This also adds several useful attributes from data available
in the httptrace callbacks:
Fixes #876