Skip to content

KTOR-5013: Fail WebSocket connection on unexpected RSV bits - #6044

Open
Arkady Bazhanov (ark-1) wants to merge 2 commits into
mainfrom
ark-1/KTOR-5013-ws-unexpected-rsv-fix
Open

Arkady Bazhanov (ark-1) wants to merge 2 commits into
mainfrom
ark-1/KTOR-5013-ws-unexpected-rsv-fix

Conversation

@ark-1

Copy link
Copy Markdown
Contributor

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.

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>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T14:00:11.712668Z c679916 New commits
🔒 Security Review ✅ Completed 2026-11-26T14:01:49.917592Z c679916 New commits
ℹ️ About Codex in GitHub

Your 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.

@bjhham Bruce Hamilton (bjhham) 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.

Looks good, just a comment about conserving per frame allocations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants