Skip to content

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

Merged
wfurt merged 3 commits into
dotnet: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 into
dotnet:release/8.0-stagingfrom
liveans:deny_unmasked_frame_receive_websocket_server_release_8

Conversation

@liveans

@liveansliveans commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

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.

CopilotAI review requested due to automatic review settings January 27, 2026 10:30
@liveansliveans 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 #123661Jan 27, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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.

FileDescription
src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/ManagedWebSocket.csAdds validation to reject unmasked frames when operating as a server, following RFC 6455 requirements
src/libraries/System.Net.WebSockets/src/Resources/Strings.resxAdds error message resource for the unmasked frame validation error
src/libraries/System.Net.WebSockets/tests/WebSocketTests.csAdds test case to verify servers reject unmasked frames and enter Aborted state with appropriate error message

@liveans

Copy link
Copy Markdown
ContributorAuthor

Approved by Tactics on 3/11 over email.

@liveansliveans added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Mar 12, 2026
Ahmet Ibrahim Aksoyand 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>
CopilotAI review requested due to automatic review settings March 12, 2026 19:34

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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.

Comment threadsrc/libraries/System.Net.WebSockets/tests/WebSocketTests.cs
@wfurt

Copy link
Copy Markdown
Member

/ba-g "known error"

@wfurt

Copy link
Copy Markdown
Member

/ba-g "known errors"

@wfurt
wfurt merged commit 88ddef8 into dotnet:release/8.0-stagingMar 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>
@rbhandarbhanda modified the milestones: 8.0.x, 8.0.26Mar 30, 2026
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Apr 30, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.NetServicing-approvedApproved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@liveans@wfurt@karelz@MihaZupan@rbhanda