-
Notifications
You must be signed in to change notification settings - Fork 330
Description
What are you trying to achieve?
According to the db spec, the db.statement value can be sanitized, but it is not defined how to do so.
Currently, the sanitization is being dealt with differently in few places.
I suggest to add a uniform format that will describe how to do the sanitization.
(It will be best if this format will apply to all different DB's and syntaxes)
Different implementations examples:
- JS mongo db - implements the sanitization by replacing the information with question marks
- Python pymongo - implements the sanitization by deleting the information completely, and leaving the query method name only
- Python elasticsearch (WIP) - suggests to replace the information with a string that will explain that the data is sanitized
I suggest a few options to replace the value with:
-
Keep the method name, and add a sanitized text.
for example:db.statement = "SELECT {query information is sanitized}"
advantages: quite easy to implement, easy to keep consistent across libraries.
dis-advantages: will require to research whether all different libraries can handle this format effectively. -
Simple text that will describe that the value is sanitized.
for example:db.statement = "query information is sanitized"
advantages: easy to implement, easy to keep consistent across different libraries.
dis-advantages: doesn't supply basic information about the query that could be useful. -
Replace the values with question marks.
for example:db.statement = "SELECT ? FROM ?"
advantages: keeps more amount of information, while still not exposing sensitive or private data.
dis-advantages: harder to implement, harder to keep consistent across libraries.
I would like to hear opinions about the suggested solutions, or hear different ideas.
Additional context.
open-telemetry/opentelemetry-specification#3104 - Issue regarding changing the recommendation to sanitize the information by default.
#708 - Issue about missing examples for sanitization in specs.