Skip to content
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

[otelmongo] Disable adding the mongo 'db.statement' tag by default #3519

Merged
merged 9 commits into from
Apr 26, 2023

Conversation

dubonzi
Copy link
Contributor

@dubonzi dubonzi commented Mar 2, 2023

As of now, the 'db.statement' tag is not obfuscated, which can lead to sensitive information being leaked through the tag.

See #3388.

As of now, the 'db.statement' tag is not obfuscated, which can lead
to sensitive information being leaked through the tag.

See open-telemetry#3388
@dubonzi dubonzi requested a review from a team March 2, 2023 00:35
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Mar 2, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: dubonzi / name: Eduardo Bonzi da Conceição (b978ed7)

@dubonzi dubonzi changed the title Disable adding the mongo 'db.statement' tag by default [otelmongo] Disable adding the mongo 'db.statement' tag by default Mar 2, 2023
@codecov
Copy link

codecov bot commented Mar 2, 2023

Codecov Report

Merging #3519 (419c4e7) into main (6682591) will increase coverage by 16.2%.
The diff coverage is 100.0%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##            main   #3519      +/-   ##
========================================
+ Coverage   70.1%   86.4%   +16.2%     
========================================
  Files        147       4     -143     
  Lines       6973     125    -6848     
========================================
- Hits        4892     108    -4784     
+ Misses      1958      14    -1944     
+ Partials     123       3     -120     
Impacted Files Coverage Δ
....mongodb.org/mongo-driver/mongo/otelmongo/mongo.go 86.8% <ø> (+86.8%) ⬆️
...mongodb.org/mongo-driver/mongo/otelmongo/config.go 100.0% <100.0%> (+100.0%) ⬆️

... and 146 files with indirect coverage changes

@dmathieu
Copy link
Member

dmathieu commented Mar 2, 2023

Thank you! 🌷
This will require a changelog entry.

@dubonzi
Copy link
Contributor Author

dubonzi commented Mar 2, 2023

Done!

Copy link
Member

@dmathieu dmathieu left a comment

Choose a reason for hiding this comment

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

(sorry for the back and forth)

I think we should update the comment in

to say something like:

// TODO sanitize values where possible, then reenable `db.statement` span attributes default.

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Member

@pellared pellared left a comment

Choose a reason for hiding this comment

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

Personally, I agree that we should be "secure by default".
Unfortunately, it is currently against the OTel specification.

https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/database.md#call-level-attributes

Can you first try addressing it in the OTel specification? I would support it 😉

Related PR in spec: open-telemetry/opentelemetry-specification#1659

@pellared
Copy link
Member

pellared commented Mar 7, 2023

Related issue in OTel spec: open-telemetry/opentelemetry-specification#3104

@dubonzi
Copy link
Contributor Author

dubonzi commented Mar 7, 2023

I added a comment in support of being able to have it disabled by default if the instrumentation doesn't implement obfuscation.

@dubonzi
Copy link
Contributor Author

dubonzi commented Mar 7, 2023

I was thinking about trying to implement obfuscation and remembered that the datadog agent does it.

Took a look at the code and doesn't seem like an easy task. Hopefully the specification changes to allow for removing the tag by default.

@pellared
Copy link
Member

pellared commented Mar 7, 2023

@dubonzi There is also an open PR here: open-telemetry/opentelemetry-specification#3127

@dubonzi
Copy link
Contributor Author

dubonzi commented Mar 7, 2023

Related issue in OTel spec: open-telemetry/opentelemetry-specification#3104

@dmathieu I see you tried to link to this PR in a comment but you linked to the wrong one. I edited my comment to include the correct link.

@dubonzi
Copy link
Contributor Author

dubonzi commented Mar 30, 2023

While the specification issue seems to be moving forward, I was thinking, would it be acceptable to use datadog's obfuscation library that is used in their agent to do the sanitization?

@pellared
Copy link
Member

pellared commented Apr 3, 2023

While the specification issue seems to be moving forward, I was thinking, would it be acceptable to use datadog's obfuscation library that is used in their agent to do the sanitization?

Obfuscation on "raw data" is never perfect. We could use similar feature as opt-in, but we should not use it by default.

EDIT:
The reason is similar to

It is not recommended to attempt any client-side parsing of db.statement just to get these properties, they should only be used if the library being instrumented already provides them.

from https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/database.md

@dubonzi
Copy link
Contributor Author

dubonzi commented Apr 11, 2023

Can we move forward with this now that the specification issue was accepted?

Copy link
Member

@pellared pellared left a comment

Choose a reason for hiding this comment

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

Side note: this package has no unit tests 😬

@MrAlias MrAlias merged commit d208339 into open-telemetry:main Apr 26, 2023
@pellared pellared added this to the untracked milestone Nov 8, 2024
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.

4 participants