Sentry.AspNet reports the server's IP as the user's IP
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- csharp
- Área
- observability
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C#
- Estrellas
- 775
- Forks
- 262
- Merge medio
- 1 d 16 h
- PR fusionados (30 d)
- 118
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de getsentry/sentry-dotnet
-
chore: remove stale IL3050/IL3053 workaround from the iOS samplePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. AbiertoState: Needs Discussion
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
getsentry/sentry-dotnet#6071 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Heap dumps: every SDK shutdown logs "Error waiting for GarbageCollectionMonitor task to complete"Posiblemente ocupada @pcbeingused33 la tomó hoy. AbiertoState: Needs Discussion
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
getsentry/sentry-dotnet#6039 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
.NET Platform: Android Task
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
getsentry/sentry-dotnet#6020 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Move the Blazor WebAssembly sample off the deprecated DevServerPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto.NET Framework: Blazor
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
getsentry/sentry-dotnet#5906 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Docs MSBuild Needs Docs Update
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
getsentry/sentry-dotnet#5691 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de getsentry/sentry-dotnet
Issues similares
-
[Bug]: Native build script prints a traceback when Git is missing from PATHPosiblemente ocupada @Jaisuryan-web la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
KnifeLemon/Filee#1953 ·
Los mantenedores suelen responder en 1 día
-
blazor dotnet easy first-contributor first-contributors good first issue help wanted up-for-grabs
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
fork-commit-merge/fork-commit-merge#8691 ·
Los mantenedores suelen responder en 1 día
-
ci: coverage job fails on app-only pull requests (single artifact extracts without its folder)Abiertobug effort:S P1
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
nightscout/nocturne#4821 ·
Los mantenedores suelen responder en 1 día
-
Audit by ear: boss warnings, other not-enough messages, ailments and barriers in a chapter 1 battleAbiertoenhancement needs-game ready-for-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Sour-Dev-Home/metaphor-accessibility#1273 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
joinrpg/joinrpg-net#6336 ·
Los mantenedores suelen responder en 1 día