elastic / apm-agent-go

https://www.elastic.co/guide/en/apm/agent/go/current/index.html
Apache License 2.0
418 stars 193 forks source link

Sanitizing raw data (JSON) #1623

Closed jonathanschmittcs closed 2 months ago

jonathanschmittcs commented 4 months ago
  1. sanitezer.go: Improved the sanitizeRequest method adding sanitizeRawData method that sanitizes JSON body of http requests.
  2. sanitizer_test.go: Created a unit test TestSanitizeRaw.

Example:

Matchers: ["id", "cardNumber", "balance"] Input: {"id": "dce2be67-89e2-4232-9052-589f23b44224", "name": "jonathan", "accountInfo": {"cardNumber": "1234123412341234", "balance": 3520.50}} Output: {"id": "[REDACTED]", "name": "jonathan", "accountInfo": {"cardNumber": "[REDACTED]", "balance": "[REDACTED]"}}

cla-checker-service[bot] commented 4 months ago

❌ Author of the following commits did not sign a Contributor Agreement: c0c8e298d045f0b24c143ed4076b2b2fca1fa2f1, 21eb099b74e5753e1884a3606995d8a6af15643d

Please, read and sign the above mentioned agreement if you want to contribute to this project

dmathieu commented 4 months ago

I don't know about this. It could lead to unexpected performance issues Also, this would be a new feature and this repository is in maintenance only.

xcloudscript commented 4 months ago

This is a real need, we adjust as necessary and contribute if you want. If it is not interesting or necessary, we can simply maintain a fork in our project here and meet our needs. Please report future updates.

dmathieu commented 4 months ago

Rather than maintain a fork, have you considered migrating to OpenTelemetry? It doesn't have sensitive data redaction (though that's being worked on https://github.com/open-telemetry/oteps/pull/255), but it's way more modular than our agent, and censoring some data in a custom exporter would be rather easy.

dmathieu commented 2 months ago

Closing this, as the project does not accept new features, and this one could have performance issues.