-
-
Notifications
You must be signed in to change notification settings - Fork 225
Remove authority from URLs sent to Sentry #2365
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
Conversation
|
I understand that the first option may not be ideal, but I have concerns that using a serializer approach would result in dual responsibility, sanitization and serialization, which could be difficult to manage. |
Yeah, that would be a fair call if the JsonSerializer was actually a performing serialization. In fact all it's doing is creating a I think I'll probably just add another method to the IJsonSerializable interface with an overload of the WriteTo method that accepts a |
@SeanFeldman finally I think you were right about this. When I dug into it futher, most of the serialization happens in a bunch of extension methods we've written in |
- Included some comments on why we don't redact User and Request on the Transaction and SentryEvent. - Moved FluentAssertions.Execution to global usings in Directory.Build.props - Added end to end test to ensure events captured on the SentryClient get redacted, if necessary
Co-authored-by: Matt Johnson-Pint <matt.johnson-pint@sentry.io>
Co-authored-by: Matt Johnson-Pint <matt.johnson-pint@sentry.io>
Co-authored-by: Matt Johnson-Pint <matt.johnson-pint@sentry.io>
Co-authored-by: Matt Johnson-Pint <matt.johnson-pint@sentry.io>
…y/sentry-dotnet into feat/sanitize-urls-2078
Fixes #2078
Description
Any URLs that are captured by the SentrySDK are sanitized per the spec (see refs below) before being sent to Sentry.
When we make HTTP requests to third party services we create a breadcrumb with the URL and also create a span that has the URL as a description. Additionally, our failed outbound HTTP requests containing UserInfo can be captured and sent to Sentry - PII in these also needs to be redacted.
Make sure that all integrations that record outgoing or incoming HTTP request structure the data like described in the
spec linked above.
References
Approach
The
SentryHttpMessageHandlerdoes things like this to add a breadcrumb:SentryHttpMessageHandleralso creates a span as follows:Breadcrumbs and various other bits of data reside on the
Scopemost of the time. This scope data get's appliedto
IEventLikeobjects (which includesTransactionandSentryEvent) before they get sent to Sentry by theSentryClient.Spans are created directly on the
Transaction.To ensure Personally Identifiable Information (PII) does not get with SentryEvents, if
SendDefaultPii == falseweredact any PII in the
SentryClent.DoSendEventmethod, just before events are sent to Sentry.Similarly, we redact PII from Transactions in the
SentryClient.CaptureTransactionmethod just before the transactionis stuffed in an Envelope.
Both
SentryEventandTransactionnow have aninternal void Redact()method that redacts any PII data in theirmember fields or recursively calls
Redact()on any complex members (e.g.SentryEvent.BreadcrumbsandTransaction.Breadcrumbs).Java implementation
The Java SDK implementation has a urlWithAuthRemoved
method they use to filter out the Auth portion of URLs:
And here are the unit tests.