HTTPbis M. West
Internet-Draft Google, Inc
Updates: 6265 (if approved) October 27, 2014
Intended status: Standards Track
Expires: April 30, 2015
First-Party Cookies
draft-west-first-party-cookies-00
Abstract
This document updates RFC6265, defining the "First-Party" attribute
for cookies, which allows servers to mitigate the risk of cross-site
request forgery and related information leakage attacks by asserting
that a particular cookie should only be sent in a "first-party"
context.
Status of This Memo
This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."
This Internet-Draft will expire on April 30, 2015.
Copyright Notice
Copyright (c) 2014 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
West Expires April 30, 2015 [Page 1]
Internet-Draft first-party-cookies October 2014
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1. Examples . . . . . . . . . . . . . . . . . . . . . . . . 3
2. Terminology and notation . . . . . . . . . . . . . . . . . . 3
2.1. First-party and Third-party Requests . . . . . . . . . . 3
3. Server Requirements . . . . . . . . . . . . . . . . . . . . . 4
3.1. Grammar . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.2. Semantics of the "First-Party" Attribute (Non-Normative) 4
4. User Agent Requirements . . . . . . . . . . . . . . . . . . . 5
4.1. The "First-Party" attribute . . . . . . . . . . . . . . . 5
4.2. Monkey-patching the Storage Model . . . . . . . . . . . . 5
4.3. Monkey-patching the "Cookie" header . . . . . . . . . . . 6
5. Authoring Considerations . . . . . . . . . . . . . . . . . . 6
5.1. Mashups and Widgets . . . . . . . . . . . . . . . . . . . 6
6. Privacy Considerations . . . . . . . . . . . . . . . . . . . 6
6.1. User Controls . . . . . . . . . . . . . . . . . . . . . . 6
7. Security Considerations . . . . . . . . . . . . . . . . . . . 7
7.1. Limitations . . . . . . . . . . . . . . . . . . . . . . . 7
8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 7
9. References . . . . . . . . . . . . . . . . . . . . . . . . . 7
9.1. Normative References . . . . . . . . . . . . . . . . . . 7
9.2. Informative References . . . . . . . . . . . . . . . . . 8
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 8
1. Introduction
Section 8.2 of [RFC6265] eloquently notes that cookies are a form of
ambient authority, attached by default to requests the user agent
sends on a user's behalf. Even when an attacker doesn't know the
contents of a user's cookies, she can still execute commands on the
user's behalf (and with the user's authority) by asking the user
agent to send HTTP requests to unwary servers.
Here, we update [RFC6265] with a simple mitigation strategy that
allows servers to declare certain cookies as "First-party cookies"
which should be attached to requests if and only if they occur in a
first-party context.
Note that the mechanism outlined here is backwards compatible with
the existing cookie syntax. Servers may serve first-party cookies to
all user agents; those that do not support the "First-Party"
attribute will simply store a non-first-party cookie, just as they do
today.
West Expires April 30, 2015 [Page 2]
Internet-Draft first-party-cookies October 2014
1.1. Examples
First-party cookies are set via the "First-Party" attribute in the
"Set-Cookie" header field. That is, given a server's response to a
user agent which contains the following header field:
Set-Cookie: SID=31d4d96e407aad42; First-Party
Subsequent requests from that user agent can be expected to contain
the following header field if and only if both the requested resource
and the resource in the top-level browsing context match the cookie.
2. Terminology and notation
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [RFC2119].
This specification uses the Augmented Backus-Naur Form (ABNF)
notation of [RFC5234].
Two sequences of octets are said to case-insensitively match each
other if and only if they are equivalent under the "i;ascii-casemap"
collation defined in [RFC4790].
The terms "active document", and "top-level browsing context" are
defined in the HTML Living Standard. [HTML]
The term "origin" and the mechanism of deriving an origin from a URI
are defined in [RFC6454].
2.1. First-party and Third-party Requests
The URL displayed in a user agent's address bar is the only security
context directly exposed to users, and therefore the only signal
users can reasonably rely upon to determine who they're talking to.
Broadly speaking, then, a "first-party" request is an HTTP request
for a resource whose URL's origin matches the origin of the URL the
user sees in the address bar. A "third-party" request is an HTTP
request for a resource at any other origin.
To be slightly more precise, given an HTTP request "request":
1. Let "context" be the top-level browsing context in the window
responsible for "request".
West Expires April 30, 2015 [Page 3]
Internet-Draft first-party-cookies October 2014
2. Let "top-origin" be the origin of the location of the active
document in "context".
3. If the origin of "request"'s URL is the same as "top-origin",
"request" is a *first-party request*. Otherwise, "request" is a
*third-party request*.
Note that we deal with the document's _location_ in step 2 above, not
with the document's origin. For example, a top-level document from
"https://example.com" which has been sandboxed into a unique origin
still creates a non-unique first-party context for subsequent
requests.
This definition has a few implications:
o New windows create new first-party contexts.
o Full-page navigations create new first-party contexts. Notably,
this includes both HTTP and ""-driven redirects.
o "