Repository navigation
Fix WebSocket UTF8 validation for empty final frames - #137030
Merged
Merged
Conversation
Co-authored-by: Copilot App <[email protected]>
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @karelz, @dotnet/ncl |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the WebSocket UTF-8 validation fix.
No open issues 🎉
What changed in this PR
Fixes ManagedWebSocket accepting incomplete UTF-8 text when a message ends with an empty continuation frame.
Changes:
- Ensures completed messages reach UTF-8 validation even when no payload bytes are received.
- Adds regression tests for incomplete and valid sequences, empty final frames, and zero-length receive buffers.
- Extends the WebSocket fuzzer to validate accumulated text payloads when messages complete.
| File | Description |
|---|---|
src/libraries/System.Net.WebSockets/tests/WebSocketUtf8Tests.cs |
Adds valid and invalid UTF-8 regression cases for empty final frames. |
src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/ManagedWebSocket.cs |
Prevents completed messages from bypassing UTF-8 validation. |
src/libraries/Fuzzing/DotnetFuzzing/Fuzzers/WebSocketFuzzer.cs |
Checks successfully received text messages for valid UTF-8. |
Review effort: Balanced
MihaZupan
enabled auto-merge (squash)
November 5, 2026 18:18
wfurt
approved these changes
Nov 5, 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.
ManagedWebSocket could accept an incomplete UTF8 sequence when a text message ended with an empty continuation frame, because the zero-byte receive path returned before validating the message.
Ensure completed messages reach UTF8 validation even when no payload bytes are received. Add regression coverage for empty final frames and zero-length receive buffers, and augment the WebSocket fuzzer to validate successfully received text messages.
Note
This description was generated with GitHub Copilot.