[Home]

Summary:ASTERISK-28949: res_http_websocket: Add masking to websocket client
Reporter:Moises Silva (moy)Labels:
Date Opened:2020-06-13 11:24:55Date Closed:2020-06-22 08:24:58
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Resources/res_http_websocket
Versions:GIT Frequency of
Occurrence
Related
Issues:
is related toASTERISK-28914 res_http_websocket: Client doesn't use mask
Environment:Attachments:
Description:The websocket client API is not performing masking. The websocket RFC 6455 mandates all frame data sent by a client to be masked (MUST).

Asterisk currently doesn't seem to use the client API at all anywhere, except for the purpose of testing the server implementation. The current server implementation does not follow RFC 6455 strictly and allows a client to send data that is not masked, instead of closing the connection as it's specified in the RFC. Not sure if you'd like to fix that, it's a simple enough check but I did not add it as it could cause broken clients out there relying on this loose behaviour.

I only found this because I'm writing a dialplan app that creates an outbound websocket connection to an upstream server and it did not work because the server closed the connection immediately with a protocol error (you can try with node.js wscat for example).

I've written a patch to fix this. I'll post the git branch next. Unfortunately in master the websocket tests were failing for me, even without my patch. I was aiming to write a test for a few masking scenarios (different payload sizes) but ran out of time for now. I'll see if I can add some during the week.

Admittedly, this improvement does not benefit anyone at the moment, but it may save time someone in the future trying to use the websocket client api.
Comments:By: Asterisk Team (asteriskteam) 2020-06-13 11:24:56.717-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

By: Friendly Automation (friendly-automation) 2020-06-22 08:25:00.159-0500

Change 14590 merged by Friendly Automation:
res_http_websocket: Add payload masking to the websocket client

[https://gerrit.asterisk.org/c/asterisk/+/14590|https://gerrit.asterisk.org/c/asterisk/+/14590]

By: Friendly Automation (friendly-automation) 2020-06-22 08:25:49.585-0500

Change 14520 merged by Friendly Automation:
res_http_websocket: Add payload masking to the websocket client

[https://gerrit.asterisk.org/c/asterisk/+/14520|https://gerrit.asterisk.org/c/asterisk/+/14520]

By: Friendly Automation (friendly-automation) 2020-06-22 08:25:54.498-0500

Change 14589 merged by Friendly Automation:
res_http_websocket: Add payload masking to the websocket client

[https://gerrit.asterisk.org/c/asterisk/+/14589|https://gerrit.asterisk.org/c/asterisk/+/14589]

By: Friendly Automation (friendly-automation) 2020-06-22 08:26:05.790-0500

Change 14585 merged by Joshua Colp:
res_http_websocket: Add payload masking to the websocket client

[https://gerrit.asterisk.org/c/asterisk/+/14585|https://gerrit.asterisk.org/c/asterisk/+/14585]