Re: [hybi] WebSocket feedback

Vladimir Katardjiev <vladimir@d2dx.com> Thu, 04 March 2010 17:09 UTC

Return-Path: <vladimir@d2dx.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 509CC3A8DAD for <hybi@core3.amsl.com>; Thu, 4 Mar 2010 09:09:49 -0800 (PST)
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.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OyXA75Q3qk1z for <hybi@core3.amsl.com>; Thu, 4 Mar 2010 09:09:48 -0800 (PST)
Received: from homiemail-a38.g.dreamhost.com (caiajhbdcaib.dreamhost.com [208.97.132.81]) by core3.amsl.com (Postfix) with ESMTP id 7CBFB3A8DAC for <hybi@ietf.org>; Thu, 4 Mar 2010 09:09:48 -0800 (PST)
Received: from dhcp122.verkstad.net (dhcp122.verkstad.net [192.36.157.122]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by homiemail-a38.g.dreamhost.com (Postfix) with ESMTP id 80169D4939 for <hybi@ietf.org>; Thu, 4 Mar 2010 09:09:49 -0800 (PST)
From: Vladimir Katardjiev <vladimir@d2dx.com>
Mime-Version: 1.0 (Apple Message framework v1077)
Content-Type: multipart/signed; boundary="Apple-Mail-4--494906213"; protocol="application/pkcs7-signature"; micalg="sha1"
Date: Thu, 04 Mar 2010 18:09:45 +0100
In-Reply-To: <4B8FD541.7060301@webtide.com>
To: Hybi <hybi@ietf.org>
References: <8B0A9FCBB9832F43971E38010638454F032E566DDF@SISPE7MB1.commscope.com> <Pine.LNX.4.64.1002150605580.29686@ps20323.dreamhostps.com> <4B8F6056.8060809@webtide.com> <CE4EF44A-6C8F-43BC-ABF4-777C1149A16F@d2dx.com> <4B8F72FA.2050908@webtide.com> <4B8F7399.40208@webtide.com> <3212A766-9009-4DD6-BA63-53CCF4E98E5D@d2dx.com> <4B8FD541.7060301@webtide.com>
Message-Id: <3B402915-D56C-4CFD-8ED2-122BE4FBBBA3@d2dx.com>
X-Mailer: Apple Mail (2.1077)
Subject: Re: [hybi] 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: Thu, 04 Mar 2010 17:09:49 -0000

On 4 mar 2010, at 16.44, Greg Wilkins wrote:
> 
> But the problem with this is it assumes success and that a 101 is the only
> possible response.

According to the current draft, page 22, step 31, there are two possible status codes accepted: 101 and 407. In the case of 407, the entire request (including the random challenge) will be resent. In the case of 101, the assumption holds. In any other case, the websocket handshake is considered to have failed.
> 
> I think that once we have gone through the process, it is very likely
> that we will see the need for return types other than 101.
> 
> For example, it will be hard to stop some servers sending a 401
> unauthorized if there are missing credentials. It might also be
> desirable to send 302 responses if a server has moved or wants
> to redirect to a non HTTP port or a secure https/wss port.

I'm not sure what a 401 could do to the client (the API doesn't allow credentials to be added, and I've never been a fan of the browser-generated "please log in" dialogs).

A 302 could be interesting. Apparently it's not in the spec right now, so maybe a new thread for that is in order?
> 
> So if websocket wants to have an exchange on the wire after the
> upgrade and before the framing starts, then sending non content
> bytes after the upgrade request has to be conditional
> receiving the 101... but then we have another round trip.
> 
> I really think we should stop trying to re-invent the HTTP upgrade
> mechanism.  If there are problems with normal HTTP upgrade, then
> raise them with HTTP bis.
> 
> If the bytes after the request header are sent as request content,
> what attack verctor is opened up?

I don't think it's an attack vector anymore. Originally, it was to prevent XHR/CORS from creating a WebSocket connection, but the requirements on Sec-* headers should avert that. Right now it has more to do with having a websocket connection fail early in case of an intermediary that doesn't understand websockets.

Vladimir