[release/8.0-staging] Deny unmasked frame receive for WebSocket Server#123662
Open
liveans wants to merge 1 commit intodotnet:release/8.0-stagingfrom
Open
Conversation
Contributor
|
Tagging subscribers to this area: @karelz, @dotnet/ncl |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR backports WebSocket RFC 6455 compliance improvements from #123485 to the release/9.0-staging branch. It adds server-side validation to reject unmasked frames from clients, which is required by the WebSocket protocol specification.
Changes:
- Added validation logic to deny unmasked frames received by WebSocket servers
- Added corresponding error message resource string
- Added unit test to verify the new validation behavior
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/ManagedWebSocket.cs | Adds validation to reject unmasked frames when operating as a server, following RFC 6455 requirements |
| src/libraries/System.Net.WebSockets/src/Resources/Strings.resx | Adds error message resource for the unmasked frame validation error |
| src/libraries/System.Net.WebSockets/tests/WebSocketTests.cs | Adds test case to verify servers reject unmasked frames and enter Aborted state with appropriate error message |
MihaZupan
approved these changes
Jan 27, 2026
This was referenced Jan 27, 2026
Open
karelz
approved these changes
Feb 3, 2026
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.
Backport of #123485 to release/8.0-staging
Increasing RFC compliance for WebSocket
Customer Impact
RFC compliance
Regression
No
Testing
Manual verification + automated tests
Risk
Low, the change only affects non‑compliant WebSocket clients sending unmasked frames, which is explicitly disallowed by RFC 6455. No behavior change is expected for compliant clients.