Sentry.AspNet reports the server's IP as the user's IP
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- csharp
- Lĩnh vực
- observability
Hướng nghiên cứu
Start with Enricher.cs to see where {{auto}} is set, then SystemWebRequestEventProcessor.cs where IpAddress ??= context.Request.UserHostAddress never fires. SentryAspNetOptionsExtensions.cs shows the processor registration order. The test Process_PresetUserIP_NotOverwritten in SystemWebRequestEventProcessorTests.cs calls the processor directly, so it misses the enricher. Done means a System.Web event with user info on and no app-set IP carries a real client or chosen IP, with a test that runs both processors. The open question of which IP to use is still undecided.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
When user info is on, events and transactions from classic ASP.NET apps never get the client's IP. They get {{auto}}, and Relay turns that into the address the server reaches Sentry from. This affects 5.15.1 and later. I found it while reviewing #5983.
What happens
- The enricher in
MainSentryEventProcessorsetsUser.IpAddressto{{auto}}when user info is on. SystemWebRequestEventProcessorruns after it, becauseAddAspNetregisters it withAddEventProcessor. ItsIpAddress ??= context.Request.UserHostAddressnever assigns anything, because the IP is already{{auto}}.- Relay resolves
{{auto}}torequest.env.REMOTE_ADDRwhen the event has one, and otherwise to the address the envelope came from. System.Web events have noREMOTE_ADDR, so they get the server's address, or the address of a NAT gateway or proxy in front of it. Relay then looks up the location of that IP, so the user shows up wherever the server runs.
Transactions go through the same enricher, and System.Web has no transaction processor, so they carry {{auto}} too.
ASP.NET Core doesn't have this problem. It puts the client IP on the scope's user before the SDK captures anything, and it also sets request.env.REMOTE_ADDR.
I confirmed the processor order with a probe on .NET 10. A processor added with AddEventProcessor that does the same ??= always sees {{auto}} when user info is on. I haven't run it end to end on IIS.
Who it affects
User info is on when the app calls ConfigureDataCollection and leaves UserInfo at its default of true. It's also on when the app doesn't call ConfigureDataCollection and sets SendDefaultPii = true.
| User info | The app sets User.IpAddress |
user.ip_address in Sentry |
|---|---|---|
| On | No | The server's IP |
| On | Yes | The app's value |
| Off | No | None |
How it got here
The enricher has set {{auto}} for apps with SendDefaultPii on since before 4.0.0. System.Web used to overwrite it with UserHostAddress, which also replaced IPs that apps set themselves, as #3337 reported. #4513 fixed that in 5.15.1 by switching to ??=, and since then {{auto}} wins.
Why the tests don't catch it
The SystemWebRequestEventProcessor tests call Process directly, so the enricher never runs. Process_PresetUserIP_NotOverwritten sets an IP before calling the processor, and the processor can't tell that apart from {{auto}}.
Open questions
- Which IP should a System.Web event carry when user info is on and the app didn't set one?
UserHostAddressis the address of the TCP connection, so behind a load balancer or a CDN it's the proxy's IP. #3337 asked for proxy handling too. - Should this wait for #4515, which wants System.Web to share ASP.NET Core's scope logic?
The same processor also replaces a username the app set on the scope, and the user ID when the principal has a name identifier claim. That's a separate bug, so it should get its own issue.
- Ngôn ngữ chính
- C#
- Star
- 775
- Fork
- 262
- Merge trung bình
- 1 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 118
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của getsentry/sentry-dotnet
-
chore: remove stale IL3050/IL3053 workaround from the iOS sampleCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởState: Needs Discussion
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
getsentry/sentry-dotnet#6071 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Heap dumps: every SDK shutdown logs "Error waiting for GarbageCollectionMonitor task to complete"Có thể đã có người làm @pcbeingused33 đã nhận hôm nay. Đang mởState: Needs Discussion
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
getsentry/sentry-dotnet#6039 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
.NET Platform: Android Task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
getsentry/sentry-dotnet#6020 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Move the Blazor WebAssembly sample off the deprecated DevServerCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở.NET Framework: Blazor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
getsentry/sentry-dotnet#5906 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Docs MSBuild Needs Docs Update
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
getsentry/sentry-dotnet#5691 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của getsentry/sentry-dotnet
Issue tương tự
-
In-car displays show 0 km/h and P while the AV drivesCó thể đã có người làm @bazilinskyy đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
bazilinskyy/coupled-sim#366 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
BaryoDev/umbraco-pwa#196 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
microsoft/fluentui-blazor#5688 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug flaky lsp-transport small
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày