Re: [hybi] Masking of Control Frames that have a zero length payload.

"Arman Djusupov" <arman@noemax.com> Wed, 22 June 2011 09:21 UTC

Return-Path: <arman@noemax.com>
X-Original-To: hybi@ietfa.amsl.com
Delivered-To: hybi@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id BB15011E8098 for <hybi@ietfa.amsl.com>; Wed, 22 Jun 2011 02:21:07 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[AWL=0.000, BAYES_00=-2.599]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hdM2jYbSdMoq for <hybi@ietfa.amsl.com>; Wed, 22 Jun 2011 02:21:07 -0700 (PDT)
Received: from mail.noemax.com (mail.noemax.com [64.34.201.8]) by ietfa.amsl.com (Postfix) with ESMTP id 65BC611E807F for <hybi@ietf.org>; Wed, 22 Jun 2011 02:21:05 -0700 (PDT)
Received: from ArmanLaptop by mail.noemax.com (IceWarp 9.4.1) with ASMTP (SSL) id FPR34503; Wed, 22 Jun 2011 12:21:03 +0300
From: Arman Djusupov <arman@noemax.com>
To: 'John Tamplin' <jat@google.com>, 'Len Holgate' <len.holgate@gmail.com>
References: <018501cc30b5$1939e460$0a00a8c0@Venus> <BANLkTi=p5=rVTS9coxyu5NjMPucXqFC23Q@mail.gmail.com>
In-Reply-To: <BANLkTi=p5=rVTS9coxyu5NjMPucXqFC23Q@mail.gmail.com>
Date: Wed, 22 Jun 2011 12:19:58 +0300
Message-ID: <004301cc30bd$93215850$b96408f0$@noemax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-Mailer: Microsoft Outlook 14.0
Thread-Index: AQH+vxgWi2wQnl1x7vFTwQEstOhfWAJj77mmlFDcQQA=
Content-Language: en-us
Cc: hybi@ietf.org
Subject: Re: [hybi] Masking of Control Frames that have a zero length payload.
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 22 Jun 2011 09:21:07 -0000

> IMHO, the utility of a zero-length frame seems low enough that it doesn't warrant adding a special case to leave off the mask if the payload length is zero.

In practice 0 length frames do appear quite often as terminal frames of messages when data is streamed from a source of unknown length. I see this happening when my implementation sends the output of an object serializer that flushes the stream and then suddenly closes it. If the message stream is closed when it doesn’t have any data buffered, there is no other option but to send the 0 length terminal frame for this message. Control frames are of course another case when the frame might contain no data.

However, I think that adding the mask to ALL frames uniformly is not a bad idea. It’s not a huge waste of bandwidth and does not cause any significant overhead, at the same time the random mask attached to the frame header increases the unpredictability of the payload which eliminates the remote chance that an attacker could produce some attack sequence by playing with opcodes and reserved flags when the API would permit using them (highly unlikely though). In any case, I do like the simplicity – “ALL frames are masked and end of story”, the fewer IF ELSE in the spec the better.

With best regards,
Arman