Skip to content

Tracing: stop adding HTTP headers as tracing attributes#707

Merged
colega merged 1 commit intomainfrom
tracing-stop-adding-http-headers-as-tracing-attributes
Jun 4, 2025
Merged

Tracing: stop adding HTTP headers as tracing attributes#707
colega merged 1 commit intomainfrom
tracing-stop-adding-http-headers-as-tracing-attributes

Conversation

@colega
Copy link
Copy Markdown
Contributor

@colega colega commented Jun 4, 2025

When I added the OTel tracing in #681 I went too far and added headers as tracing attributes.

As @bboreham pointed out, this could log potentially sensitive headers like auth tokens.

This is a quick fix to remove that from traces, we can add an allowlist or a blocklist in the future as a feature.

Signed-off-by: Oleg Zaytsev mail@olegzaytsev.com

When I added the OTel tracing in #681 I went too far and added headers as tracing attributes.

As @bboreham pointed out, this could log potentially sensitive headers like auth tokens.

This is a quick fix to remove that from traces, we can add an allowlist or a blocklist in the future as a feature.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
@colega colega mentioned this pull request Jun 4, 2025
2 tasks
Copy link
Copy Markdown
Contributor

@bboreham bboreham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK as an interim fix.

@colega colega enabled auto-merge (squash) June 4, 2025 13:56
@colega colega merged commit d2cbcee into main Jun 4, 2025
9 checks passed
@colega colega deleted the tracing-stop-adding-http-headers-as-tracing-attributes branch June 4, 2025 13:58
colega added a commit that referenced this pull request Jun 5, 2025
OTel tracing of HTTP headers was broken, as we were using the
LabelerFromContext which actually labels metrics, not adds tracing
attributes.

I fixed headers tracing, introducing an exclusion list similar to the
one we use in logging.

I also added tests for OTel tracing: I had to move these under
server/internal/ because since both Jaeger and OTel tracing set up a
global state, they need to run in different test packages.

I took a slightly different approach for excluded headers: instead of
just silently skipping them, I've added a trace attribute saying they
were present in the request: that will likely make debugging easier.

Ref: #707

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
@colega colega mentioned this pull request Jun 5, 2025
2 tasks
@colega
Copy link
Copy Markdown
Contributor Author

colega commented Jun 5, 2025

Following up with a decent fix: #709

colega added a commit that referenced this pull request Jun 5, 2025
* Fix OTel tracing of HTTP headers

OTel tracing of HTTP headers was broken, as we were using the
LabelerFromContext which actually labels metrics, not adds tracing
attributes.

I fixed headers tracing, introducing an exclusion list similar to the
one we use in logging.

I also added tests for OTel tracing: I had to move these under
server/internal/ because since both Jaeger and OTel tracing set up a
global state, they need to run in different test packages.

I took a slightly different approach for excluded headers: instead of
just silently skipping them, I've added a trace attribute saying they
were present in the request: that will likely make debugging easier.

Ref: #707

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Update CHANGELOG.md

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* s/sourceIPs/source_ips/ in OTel

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* s/excludedHeadersList/excludedHeaders/

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

* Sacrifice consistency, improve performance

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>

---------

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants