[release/8.0-staging] Deny unmasked frame receive for WebSocket Server#123662
Conversation
|
Tagging subscribers to this area: @karelz, @dotnet/ncl |
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 |
|
Approved by Tactics on 3/11 over email. |
…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>
…ebsocket_server_release_8
There was a problem hiding this comment.
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.
|
/ba-g "known error" |
|
/ba-g "known errors" |
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>
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.