Repository navigation
Harden SignalR negotiateVersion parsing. - #67908
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a SignalR client negotiation-version downgrade bug by ensuring negotiateVersion is detected via an exact query-string key match (rather than a substring search), preventing unrelated query values (e.g. ?x=negotiateVersion) from suppressing appending negotiateVersion=1.
Changes:
- Java client: switch to URL parsing to check for an existing
negotiateVersionquery parameter by exact key name. - .NET client: replace
Query.Contains("negotiateVersion")with an exact query-parameter key check usingQueryStringEnumerable. - Add regression tests in both Java and .NET for query strings containing
negotiateVersionas a value/sub-string and for existingnegotiateVersionparameters.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/SignalR/clients/java/signalr/test/src/main/java/com/microsoft/signalr/ResolveNegotiateUrlTest.java | Adds coverage for query strings that contain negotiateVersion as a value/sub-string and ensures correct version appending behavior. |
| src/SignalR/clients/java/signalr/core/src/main/java/com/microsoft/signalr/Negotiate.java | Hardens negotiateVersion detection by parsing query parameter names instead of substring matching. |
| src/SignalR/clients/csharp/Http.Connections.Client/src/Microsoft.AspNetCore.Http.Connections.Client.csproj | Includes the shared QueryStringEnumerable implementation so the client can perform exact query key checks. |
| src/SignalR/clients/csharp/Http.Connections.Client/src/Internal/Utils.cs | Adds HasQueryStringParameter helper using QueryStringEnumerable for exact key matching. |
| src/SignalR/clients/csharp/Http.Connections.Client/src/HttpConnection.cs | Uses HasQueryStringParameter to decide whether to append negotiateVersion. |
| src/SignalR/clients/csharp/Client/test/UnitTests/HttpConnectionTests.Negotiate.cs | Adds regression coverage for the previously broken URL shapes and existing negotiateVersion values. |
| src/Shared/QueryStringEnumerable.cs | Adjusts decoding implementation to be safe across TFMs by guarding intrinsics-based logic behind #if NET. |
BrennanConroy
approved these changes
Jul 21, 2026
BrennanConroy
left a comment
Member
There was a problem hiding this comment.
Scanning for negotiateVersion= would probably be the fastest, but this is perfectly fine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #67751