[hybi] Revised WebSocket Feedback

Vladimir Katardjiev <vladimir.katardjiev@ericsson.com> Mon, 08 March 2010 16:30 UTC

Return-Path: <vladimir.katardjiev@ericsson.com>
X-Original-To: hybi@core3.amsl.com
Delivered-To: hybi@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 2D6A73A69D5 for <hybi@core3.amsl.com>; Mon, 8 Mar 2010 08:30:41 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.999
X-Spam-Level:
X-Spam-Status: No, score=-1.999 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, J_CHICKENPOX_34=0.6]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id l+2KN1VCZc0s for <hybi@core3.amsl.com>; Mon, 8 Mar 2010 08:30:40 -0800 (PST)
Received: from mailgw9.se.ericsson.net (mailgw9.se.ericsson.net [193.180.251.57]) by core3.amsl.com (Postfix) with ESMTP id 9FA083A6A88 for <hybi@ietf.org>; Mon, 8 Mar 2010 08:30:37 -0800 (PST)
X-AuditID: c1b4fb39-b7c2dae000007b99-48-4b95262f92b9
Received: from esessmw0184.eemea.ericsson.se (Unknown_Domain [153.88.253.125]) by mailgw9.se.ericsson.net (Symantec Brightmail Gateway) with SMTP id AC.9D.31641.F26259B4; Mon, 8 Mar 2010 17:30:40 +0100 (CET)
Received: from esessmw0191.eemea.ericsson.se (153.88.115.84) by esessmw0184.eemea.ericsson.se (153.88.115.81) with Microsoft SMTP Server (TLS) id 8.1.375.2; Mon, 8 Mar 2010 17:30:39 +0100
Received: from ESESSCMS0361.eemea.ericsson.se ([169.254.1.202]) by esessmw0191.eemea.ericsson.se ([10.2.3.60]) with mapi; Mon, 8 Mar 2010 17:30:38 +0100
From: Vladimir Katardjiev <vladimir.katardjiev@ericsson.com>
To: "hybi@ietf.org" <hybi@ietf.org>
Date: Mon, 08 Mar 2010 17:30:36 +0100
Thread-Topic: Revised WebSocket Feedback
Thread-Index: Acq+3K7V2larVGEjRiejqmwvDfLl8A==
Message-ID: <B578CFED7FE85644A170F4F7C9D52692019544C5@ESESSCMS0361.eemea.ericsson.se>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
acceptlanguage: en-US
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Brightmail-Tracker: AAAAAA==
Subject: [hybi] Revised WebSocket Feedback
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/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: Mon, 08 Mar 2010 16:30:41 -0000

Heya,
 
So, after some implementation work it's time to channel some responses.

First, a copy/paste error. Page 31 seems to be missing Sec-WebSocket-Key2.

Same page, you probably meant | instead of " in 
	
	(such as |Cookie")

Also, this might be just my reading comprehension, but the following paragraph caused a double-take

	if a server assumes that its clients are authorized
      on the basis that they can connect [...] then the server
      should also verify that the client's handshake includes the
      invariant "Upgrade" and "Connection" parts of the handshake, and
      should send the server's handshake before changing any user data.

Checking Upgrade and Connection is redundant if Sec-WebSocket-* are present from a browser PoV;that was the point of them, no? Furthermore, it is not evident that by /sending/ a reply you're preventing cross-protocol attacks. I guess you meant by reading the client's handshake (which just happens to be a part of the "sending reply" section).

Right, time to graduate from reading comprehension into actual questions. The big addition obviously Sec-WebSocket-Key1/2. Are there any fundamental limitations on where spaces can and should occur in the header? According to my interpretation as it stands, the following string is a perfectly valid key: "    4abcd". Is this intended? And, if so, can the leading (or trailing, if so inclined) spaces cause issues when parsing by proxies/existing stacks?

Also, I must've missed the big discussion, but what's the rationale of having two key headers. One I can buy, but since it should already be impossible to create a Sec-* header from a browser, AND it is impossible to add spaces to the header value, AND it is a GET with a body, it's already triple impossible (impossibler? impossiblest?) for XHR/CORS to forge. If someone has a handy link to where this suggestion was born it'd be appreciated, because this seems like quite a bit of computation involved.

The junk characters in the handshake also seem redundant. If you already need to verify the correct number of spaces this means you are checking for spaces already. As for the garbage characters, all they made me do was replace("[^0-9]", '') instead of replace(' ', '') so I'd say they didn't alter the functionality of my code other than take up more CPU cycles.

The closing handshake is also interesting. Maybe state in 5.3. that the server shouldn't disconnect on 0xFF (instead of may; it still may, but is discouraged from doing so since it may cause data loss. If the target audience really is the kind of programmer you need to verify their code by actually ensuring they read the spaces, then make the default level of the protocol ensure data integrity, because that's what they'll see in the lab network).

Finally, and probably my smallest serious gripe, but what's up with the mix of references to ASCII and UTF-8 as characters. It is all technically correct, to nobody's surprise, but it's distracting to read. I hope it's just a transitional thing and it'll eventually be UTF-8 throughout but it was just too boring to do it all at once.

Cheers,
Vladimir

PS, some notes that border on the psychopathic crazy programmer in a dark dungeon mindset. These can be safely ignored.

Page 20:  EXAMPLE: For example

Acknowledgement: OK!

Page 22: -> If the byte is 0x3A (ASCII :)

The internet has damaged me so badly this was a smiley face.