Repository navigation
Conversation
javiercn
marked this pull request as ready for review
September 14, 2026 10:05
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
All reviewed changes are covered by passing regression tests with no unresolved blocking issues.
Pull request overview
This pull request updates SignalR’s server-side JSON hub protocol parsers to reject duplicate target properties, preventing argument/dispatch mismatches.
Changes:
- Added duplicate-target validation to both JSON parsers.
- Added invocation and stream-invocation regression tests.
- No public API changes.
File summaries
| File | Summary |
|---|---|
src/SignalR/common/SignalR.Common/test/Internal/Protocol/NewtonsoftJsonHubProtocolTests.cs |
Tests duplicate targets with target-specific binding. |
src/SignalR/common/SignalR.Common/test/Internal/Protocol/JsonHubProtocolTests.cs |
Adds duplicate-target validation cases. |
src/SignalR/common/Protocols.NewtonsoftJson/src/Protocol/NewtonsoftJsonHubProtocol.cs |
Rejects repeated target properties. |
src/SignalR/common/Protocols.Json/src/Protocol/JsonHubProtocol.cs |
Rejects repeated target properties. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
BrennanConroy
approved these changes
Sep 24, 2026
BrennanConroy
approved these changes
Sep 28, 2026
This was referenced Sep 29, 2026
Member
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. |
Contributor
|
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
This branch has not been deployed
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 #68756
Overview
The System.Text.Json and Newtonsoft.Json SignalR hub protocol parsers now reject duplicate recognized properties. This prevents crafted payloads from producing inconsistent parser state, including binding
argumentsagainst one hub method and then overwriting the dispatchtargetwith another method name.Design
There is no public API change. Each parser rejects a repeated recognized top-level property with
InvalidDataExceptionusing the messageDuplicate '<property>' property is not allowed.before reading or applying the duplicate value.The protected properties are
type,invocationId,streamIds,target,error,allowReconnect,result,item,arguments,headers, andsequenceId. The validated non-nulltargetvalue itself tracks whethertargetwas already read. Explicit presence state is used where null/default values or later parser state changes make the parsed value insufficient, including nullablesequenceId, so{type:8,sequenceId:null,sequenceId:1}is rejected as a duplicate in both parsers.Unknown extension properties remain ignored, and duplicate behavior for TypeScript, Java, and MessagePack is unchanged. The TypeScript client parses into one internally consistent last-value-wins object, while MessagePack uses positional fields.
Validation
type: 1) and stream invocation (type: 4) payloads withargumentsbetween conflictingtargetvalues against both JSON parsers. A target-specific binder usesintfor the first target andstringfor the second to reproduce the mismatch faithfully.{type:8,sequenceId:null,sequenceId:1}and Newtonsoft.Json rejected the first null with a type error instead of detecting the duplicate.A broader local
src\SignalR\build.cmd -testrun was previously attempted but could not complete because of unrelated environment limitations: Java Gradle compilation failed, ANCM native output was unavailable without MSBuild.exe, and Docker Client held a Redis test log lock. The prior PR CI completed successfully across the repository build and test matrix; checks for the latest review-fix commit will run after this push.