Re: [apps-discuss] Review of draft-ietf-hybi-thewebsocketprotocol for apps-review

Alexey Melnikov <> Fri, 05 August 2011 12:29 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 8ED0821F8B79 for <>; Fri, 5 Aug 2011 05:29:48 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -102.521
X-Spam-Status: No, score=-102.521 tagged_above=-999 required=5 tests=[AWL=0.078, BAYES_00=-2.599, USER_IN_WHITELIST=-100]
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id JGS8ZmKWarQv for <>; Fri, 5 Aug 2011 05:29:44 -0700 (PDT)
Received: from ( []) by (Postfix) with ESMTP id 03FA921F8AFD for <>; Fri, 5 Aug 2011 05:29:44 -0700 (PDT)
Received: from [] ( []) by (submission channel) via TCP with ESMTPA id <>; Fri, 5 Aug 2011 13:29:28 +0100
Message-ID: <>
Date: Fri, 05 Aug 2011 08:29:33 -0400
From: Alexey Melnikov <>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20090303 SeaMonkey/1.1.15
To: Lisa Dusseault <>
References: <>
In-Reply-To: <>
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
Cc:,, Peter Saint-Andre <>, Gabriel Montenegro <>, Pete Resnick <>
Subject: Re: [apps-discuss] Review of draft-ietf-hybi-thewebsocketprotocol for apps-review
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: General discussion of application-layer protocols <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Fri, 05 Aug 2011 12:29:48 -0000

Hi Lisa,
Thank for your review.

Lisa Dusseault wrote:
> I have been selected as the Applications Area Review Team reviewer for 
> this draft (for background on apps-review, please 
> see
> Please resolve these comments along with any other Last Call comments 
> you may receive. Please wait for direction from your document shepherd 
> or AD before posting a new version of the draft.
> Document: draft-ietf-hybi-thewebsocketprotocol (reviewed -10)
> Title: The WebSocket protocol
> Reviewer: Lisa Dusseault
> Review Date: July 20, 2011
> Readiness Summary: This draft is almost ready for publication on the 
> Standards Track, but it has a few issues that should be fixed or 
> thought about before publication.
> Document Summary: The Websocket protocol defines a HTTP handshake to 
> transition from a Web context to a bi-directional connection.  It also 
> defines framing and masking for use in the bi-directional context.  It 
> addresses a number of security concerns involving untrusted 
> application code running in browsers, but assumes that browsers are 
> trusted and servers hosting Websockets are trusted to a greater extent. 
> Major Issues
> 1.  Masking
> It would be good to state what the purpose of masking is.  The 
> sentence is "Frames sent from the client to the server are masked to 
> avoid confusing network intermediaries", but I didn't upon reading 
> this, or looking at the specification text for masking, understand why 
> network intermediaries would be confused.  A citation or further 
> explanation would be good.  I see later there's an explanation in page 
> 50, so a forward reference would also work.
Right. Several people asked about that.
> 2.  Cookie handling
> Section 5.1, 
>  The request MAY include headers associated with sending cookies,
>     as defined by the appropriate specifications [RFC6265].  These
>     headers are referred to as _Headers to Send Appropriate
>     Cookies_.
>     and
>  "Additionally, if any headers in the
>   server's handshake indicate that cookies should be set (as defined by
>   [RFC6265]), these cookies are referred to as _Cookies Set During the
>   Server's Opening Handshake_."
>  and 
> Section 5.2.1, point 8
>   8.  Optionally, other headers, such as those used to send cookies to
>      a server.  Unknown headers MUST be ignored.
> First, a nit:   these important underlined terms are referred to 
> where?  I didn't see anywhere where these terms are used other than 
> where they are defined here.
I don't think they are used in the document, but I am wondering if they 
are used in the W3C's API draft. Ian?
> The more substantive issue: I'm left unclear as to whether cookies are 
> really expected to be used, or how the client might know that it needs 
> to use cookies or else the application will not work.  In many Web 
> sites, the site will not work if cookies are not used by the client, 
> and this is sufficiently rare that it's OK.  Is that OK for a 
> Websockets app?  How will the user know how to fix the problem?  Since 
> Websockets can't as easily reply with a Web page to explain how to 
> enable cookies, it would be good to be more clear on this.
My understanding is that cookies are truly optional. I will update the 
draft to clarify that.
> 3.  Failing a WebSocket Connection
> Section 7.1.7 is supposed to describe how to _Fail the WebSocket 
> Connection_.  It explains how the client does so.  However, there's at 
> least one case in section 9.1 where the server receiving a malformed 
> Sec-WebSocket-Extensions header must _Fail the WebSocket Connection_. 
>  How does the server do this?
Good catch. I've added missing text to section 7.1.7
> 4.  Dropping with extreme prejudice
> >From the Security Considerations: 
> "If at any time a server is faced with data that it does not
> understand, or that violates some criteria by which the server
> determines safety of input, or when the server sees an opening
> handshake that does not correspond to the values the server is
> expecting (e.g. incorrect path or origin), the server SHOULD just
> disconnect.  It is always safe to disconnect."
> This seems pretty excessive.  When the server just disconnects, the 
> client can't tell much about what went wrong, and whether an automated 
> retry would be any use at all.  This is bad for deployed use, and even 
> worse for development/debugging.  Yet we're recommending servers be 
> that unhelpful?  Wouldn't it be better to recommend that the server 
> reply with an error response (some HTTP status codes defined here, 
> too) that can help the client diagnose an incorrect origin?  An error 
> like that is often going to be a mis-configuration on one side or the 
> other, rather than an attack.
I agree with you. Here is the latest proposed text:

      <t>If at any time a server is faced with data that it does not 
      or that violates some criteria by which the server determines 
safety of input,
      or when the server sees an opening handshake that does not 
correspond to
      the values the server is expecting (e.g. incorrect path or origin),
      the server MAY drop the TCP connection. If the invalid data 
received after
      a successful WebSocket handshake, the server SHOULD send a Close 
frame with an
      appropriate status code <xref target='status_codes'/> before
      proceeding to <spanx style='emph'>Close the WebSocket 
      Use of a Close frame with an appropriate status code can help in 
      the problem.
      If the invalid data is sent during the WebSocket handshake the 
server SHOULD
      return an appropriate HTTP <xref target='RFC2616'/> status code.

Do you think this addresses your concern? I didn't specify any 
particular HTTP error code, because several might be applicable.
> I'd also like to know what the websockets server implementations 
> currently do.
> Minor Issues
> The reservation of different ranges of error codes for use by 
> extensions, libraries and frameworks, and application code, seems to 
> be intended to avoid conflicts between those kinds of use.  I don't 
> think it will work very well.  I don't understand where a library ends 
> and application code begins, even in code I write where I write an 
> error_handler to be called by the library I'm using (which might be a 
> "library" only for convenience sake or might be a library that dozens 
> of other software programs use).  
> The border between code and "extensions" is not even very clear; if 
> somebody writes an extension intending to publish an internet-draft 
> but never gets around to it, they may have ended up using the wrong 
> range with the right intentions.
> The border between extensions and "this protocol" is not very clear; 
> if I submit a internet-draft with a feature proposed to be a 
> requirement for websockets, I might prefer to use a 1000-1999 range 
> error code but if the feature is relegated to an optional draft it 
> should change to 2000-2999 range. 
> This kind of ambiguity leads to arguments at best, unnecessary changes 
> to code (when specs are changed late after such arguments) at worst. 
>  I'm not sure what to recommend; perhaps only one range reserved for 
>  "this protocol and extensions published within the IETF process", and 
> another range for "libraries, frameworks and application code".
I think I've convinced Ian that you are right :-). We will work on 
reducing the number of error code ranges.

Best Regards,