Sentry.AspNet overwrites the username and user ID the app set
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start in src/Sentry.AspNet/Internal/SystemWebRequestEventProcessor.cs around lines 81-92, where the username and user-ID claim are assigned without checking the existing event user. Read src/Sentry/SentryClient.cs around line 360 to see that scope user data is applied before processors run, and compare with the ASP.NET Core check in src/Sentry.AspNetCore/ScopeExtensions.cs. Existing Sentry.AspNet tests set no user, so the first step is a test that sets scope.User and confirms the processor leaves it intact; the open questions about partial user fields need a maintainer decision before the fix is settled.
由索引模型根据 Issue 内容生成。
描述
When user info is on, SystemWebRequestEventProcessor overwrites the username and user ID that the app set on the scope. It's in the block of code that #5985 covers, and I found both while reviewing #5983.
What happens
SentryClient applies the scope before it runs the event processors, so a user the app set with SentrySdk.ConfigureScope(scope => scope.User = ...) is already on the event. The System.Web processor then sets the username and the user ID. The username comes from HttpContext.User.Identity.Name, and the user ID comes from the name identifier claim when the principal has one. Neither assignment checks whether the event already has a user.
For anonymous requests, ASP.NET attaches an identity with an empty name. The default authentication module does it unless Windows authentication already has. The processor copies that empty name, and the SDK drops blank usernames when it serializes the event. So the username the app set disappears.
For signed-in requests, the identity's name replaces the app's username. The name identifier claim, when the principal has one, replaces the app's user ID.
This only affects events. Transactions don't go through the processor, so they keep the app's user.
ASP.NET Core only fills in the user when the scope doesn't have one. System.Web can't copy that check as is. By the time the processor runs, the SDK has already filled in defaults such as the OS username, {{auto}} and the installation ID, so the event always has a user.
The Data Collection spec says the SDK must always attach data the app sets on the scope, and must not modify it.
No test sets a username or user ID before calling the processor. I traced this through the code and haven't run it end to end on IIS.
Who it affects
It affects apps that set a user on the scope and have user info on. Today that's apps with SendDefaultPii = true. Once #5983 merges, it's also apps that call ConfigureDataCollection and leave UserInfo at its default of true.
Open questions
- When the app sets only some user fields, should System.Web fill in the rest from the request, or add nothing, as ASP.NET Core does?
- Should this be part of #4515, which wants System.Web to share ASP.NET Core's scope logic?
- 主要语言
- C#
- 星标
- 775
- 派生
- 262
- 平均合并
- 1 天 16 小时
- 30 天内合并 PR
- 118
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
getsentry/sentry-dotnet 的其他 Issue
-
chore: remove stale IL3050/IL3053 workaround from the iOS sample可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭State: Needs Discussion
难度 2/5 1-3 小时 新手友好度 76/100
getsentry/sentry-dotnet#6071 · 1 条评论 ·
维护者通常 1 天内回复
-
Heap dumps: every SDK shutdown logs "Error waiting for GarbageCollectionMonitor task to complete"可能已有人在做 @pcbeingused33 今天认领。 未关闭State: Needs Discussion
难度 2/5 1-3 小时 新手友好度 76/100
getsentry/sentry-dotnet#6039 · 3 条评论 ·
维护者通常 1 天内回复
-
.NET Platform: Android Task
难度 2/5 1-3 小时 新手友好度 75/100
getsentry/sentry-dotnet#6020 · 3 条评论 ·
维护者通常 1 天内回复
-
Move the Blazor WebAssembly sample off the deprecated DevServer可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭.NET Framework: Blazor
难度 2/5 1-3 小时 新手友好度 67/100
getsentry/sentry-dotnet#5906 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
Docs MSBuild Needs Docs Update
难度 2/5 1-3 小时 新手友好度 68/100
getsentry/sentry-dotnet#5691 · 1 条评论 ·
维护者通常 1 天内回复
查看 getsentry/sentry-dotnet 的全部 Issue
相似的 Issue
-
In-car displays show 0 km/h and P while the AV drives可能已有人在做 @bazilinskyy 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 66/100
bazilinskyy/coupled-sim#366 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
BaryoDev/umbraco-pwa#196 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
microsoft/fluentui-blazor#5688 ·
维护者通常 1 天内回复
-
bug flaky lsp-transport small
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复