sentry-dotnet
sentry-dotnet copied to clipboard
Sentry dotnet SDK is blowing away User.IpAddress if we set it explicitly and SendDefaultPii is true
Package
Sentry
.NET Flavor
.NET
.NET Version
4.7.2
OS
Windows
SDK Version
4.4.0
Self-Hosted Sentry Version
No response
Steps to Reproduce
- Set SendDefaultPii to true during SentrySdk.Init call
- Create new SentryEvent - and set the event's User.IpAddress to a specific value.
- Call SentrySdk.CaptureEvent and pass in the event.
Expected Result
The Sentry dashboard should show the User's IP as the one we set.
Actual Result
It appears to always contain an internal/server IP instead. I believe this may be because of this code? https://github.com/getsentry/sentry-dotnet/blob/5bcb9cac8b54f283a4ce5cc16573bfdf2970cdf9/src/Sentry.AspNet/Internal/SystemWebRequestEventProcessor.cs#L75
But I am honestly not certain.
If I am doing something wrong here, would love guidance. But we have our own logic that fires off before a Sentry event sends - and if it's inside a web requests - gets the current user context (who's logged in) and IP address data, then stamps it onto the SentryEvent. We get the IP address ourselves because we're parsing CloudFlare/proxy IPs in the HTTP headers.