Skip to content

Conversation

@liveans
Copy link
Member

@liveans liveans commented Jan 22, 2026

Increasing RFC-compliance for WebSocket

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request enhances RFC 6455 compliance for WebSocket servers by adding validation to reject unmasked frames from clients. According to the RFC, clients must mask all frames sent to servers, and servers should reject unmasked frames.

Changes:

  • Added validation logic to reject unmasked frames when running as a WebSocket server
  • Added a test case to verify the server properly rejects unmasked frames with appropriate error handling
  • Added a new resource string for the error message

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/ManagedWebSocket.cs Adds server-side validation to reject unmasked frames, mirroring the existing client-side check for masked frames
src/libraries/System.Net.WebSockets/tests/WebSocketTests.cs Adds test to verify server rejects unmasked frames and transitions to Aborted state
src/libraries/System.Net.WebSockets/src/Resources/Strings.resx Adds error message resource for unmasked frame rejection

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Member

@CarnaViire CarnaViire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@liveans liveans enabled auto-merge (squash) January 22, 2026 12:50
@liveans liveans merged commit 777287d into dotnet:main Jan 22, 2026
89 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants