Repository navigation
Bind SignalR connections to negotiated identity - #70450
Conversation
Co-authored-by: Copilot <[email protected]> Copilot-Session: fdac132c-0926-4fda-8c97-88ae5b59b9fd
There was a problem hiding this comment.
🔵 Needs a closer look
Concurrent refresh/transport identity publication and Windows principal ownership changes require human review and CI evidence because managed regressions and Windows handle lifetimes were not runtime-validated.
No open issues 🎉
What changed in this PR
This PR binds SignalR’s HTTP connections to the identity established during negotiation, adding identity checks across transport initialization and authentication refresh while preserving equivalent-principal matching.
Changes:
- Adds immutable identity snapshots with preferred-claim, authenticated-claim, and name-based matching.
- Integrates negotiated identity tracking, request validation, and retained Windows identity cleanup into the connection lifecycle.
- Adds regression coverage for identity matching, transport startup, stale tokens, and concurrent refreshes.
The PR reports that local managed tests were blocked by an MSBuild/SDK mismatch; CI validation remains necessary.
| File | Description |
|---|---|
src/SignalR/common/Http.Connections/test/HttpConnectionDispatcherTests.cs |
Tests negotiated identity matching and send validation across transports. |
src/SignalR/common/Http.Connections/test/HttpConnectionDispatcherTests.ConnectionBindingRefresh.cs |
Adds hosted tests for token expiration differences and competing initialization requests. |
src/SignalR/common/Http.Connections/test/HttpConnectionDispatcherTests.AuthenticationRefresh.cs |
Covers pre-connect refreshes, Windows identities, stale tokens, and refresh races. |
src/SignalR/common/Http.Connections/src/Internal/UserIdentitySnapshot.cs |
Captures and compares immutable identity information. |
src/SignalR/common/Http.Connections/src/Internal/HttpConnectionManager.cs |
Passes negotiated principals into connection creation. |
src/SignalR/common/Http.Connections/src/Internal/HttpConnectionDispatcher.cs |
Captures negotiation identity and validates transport and refresh requests. |
src/SignalR/common/Http.Connections/src/Internal/HttpConnectionContext.cs |
Tracks negotiated identity state and manages principal ownership and cleanup. |
Review effort: Balanced
|
/review |
There was a problem hiding this comment.
Source-only review of frozen head 7c4d95b96b1974dbabfa8bbbcb03f0bd6ab733a6.
The routed cross-cutting guide completed. Its sole concrete candidate was independently verified and discarded: the merge base did not bind the negotiate principal before the first transport request, so the proposed Cookie-to-Bearer fallback-claim sequence was accepted by both old and new code. No verified or unresolved new defect remains. Frozen existing feedback contained no equivalent concrete finding; deduplication is not an endorsement of prior feedback.
Runtime, test, CI, browser, and sample execution were excluded by the supplied source-only policy; security assessment was excluded by assigned guidance. SignalR-specific domain review was not routed, so materially changed SignalR identity-binding behavior remains uncovered by a specialist guide. Evidence is limited to tracked frozen source bytes, the complete frozen diff, projected metadata, and feedback prepared in the bundle; no feedback posted after preparation is observable.
Generated by ASP.NET Core Pull Request Review for #70450 · copilot · gpt56 · 156.2 AIC · ⌖ 21.4 AIC · ⊞ 18.8K
Comment /review to run again
| { | ||
| return current._allAuthenticatedClaims is not null | ||
| && incoming._allAuthenticatedClaims is not null | ||
| && current._allAuthenticatedClaims.AsSpan().SequenceEqual(incoming._allAuthenticatedClaims); |
There was a problem hiding this comment.
[DISCARDED] Authentication-type omission does not regress the first-transport sequence
Why discarded: At the merge base, HttpConnectionDispatcher did not retain or compare the negotiate principal; the first transport request started with connection.User == null and installed its own principal. Therefore a negotiate principal with an employeeId claim under Cookie followed by the same claim under Bearer proceeds both before and after this change.
Minimal repro: Negotiate a long-polling connection with new ClaimsIdentity([new Claim("employeeId", "1")], "Cookie"), then issue the first transport GET with the same claim under "Bearer".
What goes wrong: Nothing regresses on this sequence; both frozen old and head behavior accept the request.
Fix: none
|
ℹ️ This pull request wasn't processed automatically. This change requires specialized review. Please confirm whether documentation updates are needed and handle them through the appropriate process. |
Description
Bind a SignalR connection to the identity established during negotiation. Transport and authentication-refresh requests from a different identity are rejected, while equivalent principals continue to work.
This addresses CVE-2026-114146.
Validation
Focused regression coverage is included. Managed tests were not completed locally because the current repository bootstrap selected an MSBuild version below the repository SDK minimum; normal PR CI is required before merge.