Closed Bug 1741483 Opened 4 years ago Closed 4 years ago

Websocket frame with no payload

Categories

(Core :: DOM: Networking, defect)

Firefox 94
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: edward.a.cheney.mil, Unassigned)

Details

Steps to reproduce:

Reproduction rate: 100% reproducible

Environment

  • Firefox 94
  • Bohdi Linux on VirtualBox VM running on Windows 10 host. Bohdi Linux is an Ubuntu with a much better GUI for VMs.

Steps from terminal:
The following steps bring down my application, install it, and run localhost services

  1. git clone from https://github.com/prettydiff/share-file-systems/commit/37f2ff558bf5d1dd892d4f3dba1c9c9ea4fbe7a5
  2. npm install -g typescript
  3. cd share-file-systems
  4. npm install
  5. tsc
  6. node js/application build
  7. share

Steps in Firefox Browser:
These steps use the application and transmit the websocket message

  1. Navigate to http://localhost
  2. Complete the form, two text fields. It doesn't matter what text you submit.
  3. Delete ./lib/storage/device.json file from within the application to achieve 100% reproducibility.

Analysis in the code:
These steps will allow the application to output the frame header details of a websocket message to the console.

  1. Open file ./js/lib/terminal/server/transmission/agent_ws.html
  2. At the end of line 106 insert if(frameItem.opcode===1)console.log(frameItem); to see the frame header of the message.

Browser code:
Line 59 of ./js/lib/browser/webSocket.js

Actual results:

I am see a websocket message come from Firefox to a Node application without the message payload. The frame header indicates a payload size of about 1455 bytes, but the total data size of the message is 8 bytes. 8 bytes is large enough for 2 bytes of frame header, 2 bytes of extended length, and 4 bytes of mask key. That is everything except the actual message payload, the remaining 1455 bytes. I can produce this problem 100% of the time. I also tried using Chromium on the same machine using the same steps and can produce this issue 0%.

Expected results:

The data size of this message should be 1463, which is the payload size plus the first 8 bytes of frame headers.

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Networking' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → DOM: Networking
Product: Firefox → Core

I've tried to reproduce with your steps, but got an error below:

TypeScript Compilation
lib/terminal/server/transmission/agent_http.ts:81:78 - error TS2352: Conversion of type '`GET ${string}`' to type 'requestType' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Type '`GET ${string}`' is not comparable to type '"test-browser"'.

81                 const requestType:requestType = (request.method === "GET") ? `GET ${request.url}` as requestType : request.headers["request-type"] as requestType,
                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error.

Could you try to create a minimal node application that demonstrates this issue? Thanks.

Flags: needinfo?(edward.a.cheney.mil)

Close this because we don't have enough information.

Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Flags: needinfo?(edward.a.cheney.mil)
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.