Re: [whatwg] WebSockets and redirects

2011-03-30 Thread James Graham

On 03/30/2011 12:12 AM, Jonas Sicking wrote:

But I'm totally fine with punting on this for the future and just
disallowing redirects on an API level for now.


Yes, I think this is the right thing to do at the moment.


Re: [whatwg] WebSockets and redirects

2011-03-30 Thread And Clover
On Tue, 2011-03-29 at 15:12 -0700, Jonas Sicking wrote:
 I'm totally fine with punting on this for the future and just
 disallowing redirects on an API level for now.

+1. It has proved hard enough to get an acceptably-secure WebSocket
interface on the bare minimum of features. Let's not introduce more
issues by adding more features that aren't completely necessary now.

-- 
And Clover
mailto:a...@doxdesk.com
http://www.doxdesk.com
gtalk:chat?jid=bobi...@gmail.com



[whatwg] WebSockets and redirects

2011-03-29 Thread Adam Barth
In this HyBi thread:

http://www.ietf.org/mail-archive/web/hybi/current/msg06951.html

Folks are arguing that the WebSocket protocol should support HTTP
redirects during the handshake and that dealing with the security
consequences of redirects should be dealt with at the API layer.
If/when that occurs, we should update the API layer to deal with the
security consequences of the WebSocket protocol following HTTP
redirects, preferably by aborting any WebSocket connections that the
server attempts to redirect.

Adam


Re: [whatwg] WebSockets and redirects

2011-03-29 Thread Jonas Sicking
On Tue, Mar 29, 2011 at 10:34 AM, Adam Barth w...@adambarth.com wrote:
 In this HyBi thread:

 http://www.ietf.org/mail-archive/web/hybi/current/msg06951.html

 Folks are arguing that the WebSocket protocol should support HTTP
 redirects during the handshake and that dealing with the security
 consequences of redirects should be dealt with at the API layer.
 If/when that occurs, we should update the API layer to deal with the
 security consequences of the WebSocket protocol following HTTP
 redirects, preferably by aborting any WebSocket connections that the
 server attempts to redirect.

I absolutely agree that redirects are a big source of security
problems. If we are going to support them for websocket then I think
we need to learn from the mistakes of http as to not repeat the
problems that occurred there.

One solution could be to add a redirect API on the WebSocket
interface. By default we would not follow the redirect but instead
fire an event on the WebSocket object. The event would contain the URL
which the server wants to redirect to. Only if the page explicitly
signals that it wants to follow the redirect would we do so.

This signaling could be done by calling .preventDefault() on the
event, or by calling some .yesPleaseFollowRedirect() function on the
event. It could also be done by making the implementation close the
websocket object before firing the event, but allowing the page to
call .open on the object and pass in an arbitrary url, for example the
url which was received from the redirect event.

But I'm totally fine with punting on this for the future and just
disallowing redirects on an API level for now.

/ Jonas