[hybi] Question about Sec-WebSocket-Accept paragraph

Joel Martin <hybi@martintribe.org> Thu, 16 June 2011 15:56 UTC

Return-Path: <buskanaka@gmail.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 316CC11E818B for <hybi@ietfa.amsl.com>; Thu, 16 Jun 2011 08:56:36 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.976
X-Spam-Level:
X-Spam-Status: No, score=-2.976 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-1]
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 cPJEQWq6Vzli for <hybi@ietfa.amsl.com>; Thu, 16 Jun 2011 08:56:35 -0700 (PDT)
Received: from mail-wy0-f172.google.com (mail-wy0-f172.google.com [74.125.82.172]) by ietfa.amsl.com (Postfix) with ESMTP id 3410E11E814C for <hybi@ietf.org>; Thu, 16 Jun 2011 08:56:35 -0700 (PDT)
Received: by wyb29 with SMTP id 29so1320038wyb.31 for <hybi@ietf.org>; Thu, 16 Jun 2011 08:56:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:from:date :x-google-sender-auth:message-id:subject:to:content-type; bh=j9KCEhHIn3oIqzK5tZj8zDzNB+iAq/08VFZgfdl77mQ=; b=MT/DaPHJkP8/RRBVSZv2ncH+u8IhWDPV/NHjMIx50hlQJnqXx2rS3JRqIdMCbvxA3R Nzdj5LiS84v5AIL+TyaH1O+POZbez9A2nrdEPbgg4UAf9AEa6/QEaJOQoR2Eh67jPViX MGLcTXHzaC2nACDC73VZZKRsSuubEK9iVw+bY=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:from:date:x-google-sender-auth:message-id :subject:to:content-type; b=QEdbab9AOveCHaV2OZvRXbcp4iMJHAumbzLsAxzBgvTtUwk9xw3GXQNZAFkNLBngSE 0mg2WZtvFN+4f8ZNaQ1ptPWN6/6jA5lHl0pu/8MeIDrPcaM31Vqi9/szU3XKom0AYykn J0skVAdKqc630a0F6jcpN1ENqqFwbOeY4b7tM=
Received: by 10.227.24.8 with SMTP id t8mr1111797wbb.0.1308239794186; Thu, 16 Jun 2011 08:56:34 -0700 (PDT)
MIME-Version: 1.0
Sender: buskanaka@gmail.com
Received: by 10.227.69.3 with HTTP; Thu, 16 Jun 2011 08:56:13 -0700 (PDT)
From: Joel Martin <hybi@martintribe.org>
Date: Thu, 16 Jun 2011 10:56:13 -0500
X-Google-Sender-Auth: By3MIvm2AwQfIhcfFEmHGFfEws0
Message-ID: <BANLkTinYPmc9FgMRN10zCupu5XUyEeUSSg@mail.gmail.com>
To: hybi@ietf.org
Content-Type: multipart/alternative; boundary="00221597512e36ac1304a5d650bb"
Subject: [hybi] Question about Sec-WebSocket-Accept paragraph
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: Thu, 16 Jun 2011 15:56:36 -0000

Sorry for the bogus subject in the previous post.

On Thu, Jun 16, 2011 at 10:54 AM, Joel Martin <hybi@martintribe.org> wrote:

> I started to try and answer this StackOverflow question about the protocol
> text and realized that I didn't understand it as well as I thought:
>
> http://stackoverflow.com/questions/6372252/why-does-the-server-in-a-websocket-request-have-to-answer-a-challenge
>
> The question is related to this paragraph (which has been in the drafts for
> a while unchanged):
>
>     Finally, the server has to prove to the client that it received the
>     client's WebSocket handshake, so that the server doesn't accept
>     connections that are not WebSocket connections.  This prevents an
>     attacker from tricking a WebSocket server by sending it carefully-
>     crafted packets using |XMLHttpRequest| or a |form| submission.
>
> I can see how the Sec-WebSocket-Accept would prevent a WebSocket client
> from being tricked into connecting to a non-WebSocket server. However, I'm
> having difficulty understanding how the Sec-WebSocket-Accept header would
> prevent a XMLHttpRequest from succeeding to a WebSockets server since it is
> sent from the server. I am aware of the prohibition against "Sec-" headers
> in the client to server direction. Is there a requirement that
> XMLHttpRequest responses with unrecognized "Sec-" headers be rejected by
> user agents (and if so does this only apply in the browser case)?
>
> It's likely I just don't have enough context to understand the paragraph,
> but perhaps it could be clarified a bit.
>
> Regards,
>
> Joel Martin
>