Repository navigation
KTOR-5013: Fail WebSocket connection on unexpected RSV bits - #6044
Open
Arkady Bazhanov (ark-1) wants to merge 2 commits into
Open
Arkady Bazhanov (ark-1) wants to merge 2 commits into
Arkady Bazhanov (ark-1) wants to merge 2 commits into
Conversation
Close with PROTOCOL_ERROR when a data frame has an RSV bit that no negotiated extension uses (RFC 6455, section 5.2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Bruce Hamilton (bjhham)
requested changes
Nov 26, 2026
Bruce Hamilton (bjhham)
left a comment
Contributor
There was a problem hiding this comment.
Looks good, just a comment about conserving per frame allocations.
Arkady Bazhanov (ark-1)
requested review from
Alexander Sysoev (Mr3zee) and
Bruce Hamilton (bjhham)
November 26, 2026 13:59
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.
Close with PROTOCOL_ERROR when a data frame has an RSV bit that no negotiated extension uses (RFC 6455, section 5.2).
Subsystem
WebSockets
Motivation
KTOR-5013 "Websockets: Connection should be failed immediately when RSV is set but not previously negotiated"
Solution
DefaultWebSocketSession now checks the set reserved RSV bits and if no negotiated extension uses them it throws ProtocolViolationException + closes the WebSocket with PROTOCOL_ERROR.
Ping/Pong/Close Frames are not checked, as they are constructed on a lower level, but arguably that's a very niche case to check.
Assisted by Claude.