Skip to content

WebSocket codec accepts a new data frame during an active continuation #4215

Description

@robjtede

Summary

The actix-http WebSocket codec accepts a complete Text or Binary frame while a fragmented message is already in progress. RFC 6455 requires all subsequent data frames in that message to use the continuation opcode (0).

Reproduction

Run the Autobahn fuzzing client against the websockets/autobahn example converted to actix-ws.

  • Autobahn case: 5.18
  • Description: send a text message fragmented into two frames, with both frame opcodes set to Text
  • Expected: reject the connection with protocol error 1002 (or drop the TCP connection) without delivering a message
  • Actual: the server delivers fragment2 as a message and closes with 1001

Likely cause

In actix-http/src/ws/codec.rs, the decoder checks continuation state for non-final frames, but the final-frame match returns Frame::Text or Frame::Binary without checking whether Flags::CONTINUATION is already set.

Suggested fix

Reject a final Text or Binary frame when a continuation is active, returning the existing continuation-state protocol error. Add a codec regression test and retain Autobahn case 5.18 as end-to-end coverage.

This is one of the remaining protocol failures from #1006. Legal fragmented messages already pass through actix-ws aggregation; this report concerns invalid frame sequencing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions