Skip to content

[release/8.0-staging] Deny unmasked frame receive for WebSocket Server#123662

Merged
wfurt merged 3 commits intodotnet:release/8.0-stagingfrom
liveans:deny_unmasked_frame_receive_websocket_server_release_8
Mar 13, 2026
Merged

[release/8.0-staging] Deny unmasked frame receive for WebSocket Server#123662
wfurt merged 3 commits intodotnet:release/8.0-stagingfrom
liveans:deny_unmasked_frame_receive_websocket_server_release_8

Conversation

@liveans
Copy link
Member

@liveans liveans commented Jan 27, 2026

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.

Copilot AI review requested due to automatic review settings January 27, 2026 10:30
@liveans liveans changed the title [release/9.0-staging] Deny unmasked frame receive for WebSocket Server #123661 [release/8.0-staging] Deny unmasked frame receive for WebSocket Server #123661 Jan 27, 2026
@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 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

@liveans
Copy link
Member Author

liveans commented Mar 12, 2026

Approved by Tactics on 3/11 over email.

@liveans liveans added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Mar 12, 2026
liveans and others added 2 commits March 12, 2026 17:40
…ccessible SR reference

- Add 'using System.Threading;' for CancellationToken
- Replace SR.net_Websockets_ServerReceivedUnmaskedFrame with string literal (SR is internal to src, not accessible from tests)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 12, 2026 19:34
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

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


You can also share your feedback on Copilot code review. Take the survey.

@wfurt
Copy link
Member

wfurt commented Mar 13, 2026

/ba-g "known error"

@wfurt
Copy link
Member

wfurt commented Mar 13, 2026

/ba-g "known errors"

@wfurt wfurt merged commit 88ddef8 into dotnet:release/8.0-staging Mar 13, 2026
108 of 116 checks passed
wfurt added a commit to jozkee/runtime that referenced this pull request Mar 13, 2026
dotnet#123662)

Backport of dotnet#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.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Tomas Weinfurt <tweinfurt@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Net Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants