idnits 2.17.1 draft-west-cookie-prefixes-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (October 8, 2015) is 3123 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) No issues found here. Summary: 1 error (**), 0 flaws (~~), 1 warning (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 HTTPbis M. West 3 Internet-Draft Google, Inc 4 Updates: 6265 (if approved) October 8, 2015 5 Intended status: Standards Track 6 Expires: April 10, 2016 8 Cookie Prefixes 9 draft-west-cookie-prefixes-01 11 Abstract 13 This document updates RFC6265 by adding a set of restrictions upon 14 the names which may be used for cookies with specific properties. 15 These restrictions enable user agents to smuggle cookie state to the 16 server within the confines of the existing "Cookie" request header 17 syntax, and limits the ways in which cookies may be abused in a 18 conforming user agent. 20 Status of This Memo 22 This Internet-Draft is submitted in full conformance with the 23 provisions of BCP 78 and BCP 79. 25 Internet-Drafts are working documents of the Internet Engineering 26 Task Force (IETF). Note that other groups may also distribute 27 working documents as Internet-Drafts. The list of current Internet- 28 Drafts is at http://datatracker.ietf.org/drafts/current/. 30 Internet-Drafts are draft documents valid for a maximum of six months 31 and may be updated, replaced, or obsoleted by other documents at any 32 time. It is inappropriate to use Internet-Drafts as reference 33 material or to cite them other than as "work in progress." 35 This Internet-Draft will expire on April 10, 2016. 37 Copyright Notice 39 Copyright (c) 2015 IETF Trust and the persons identified as the 40 document authors. All rights reserved. 42 This document is subject to BCP 78 and the IETF Trust's Legal 43 Provisions Relating to IETF Documents 44 (http://trustee.ietf.org/license-info) in effect on the date of 45 publication of this document. Please review these documents 46 carefully, as they describe your rights and restrictions with respect 47 to this document. Code Components extracted from this document must 48 include Simplified BSD License text as described in Section 4.e of 49 the Trust Legal Provisions and are provided without warranty as 50 described in the Simplified BSD License. 52 Table of Contents 54 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 55 2. Terminology and notation . . . . . . . . . . . . . . . . . . 2 56 3. Prefixes . . . . . . . . . . . . . . . . . . . . . . . . . . 3 57 3.1. The "$Secure-" prefix . . . . . . . . . . . . . . . . . . 3 58 3.2. The "$Origin-" prefix . . . . . . . . . . . . . . . . . . 3 59 4. User Agent Requirements . . . . . . . . . . . . . . . . . . . 4 60 5. Aesthetic Considerations . . . . . . . . . . . . . . . . . . 4 61 6. Security Considerations . . . . . . . . . . . . . . . . . . . 4 62 7. Normative References . . . . . . . . . . . . . . . . . . . . 4 63 Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 5 64 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 5 66 1. Introduction 68 Section 8.5 and Section 8.6 of [RFC6265] spell out some of the 69 drawbacks of cookies' implementation: due to historical accident, it 70 is impossible for a server to have confidence that a cookie set in a 71 secure way (e.g., as a domain cookie with the "Secure" (and possibly 72 "HttpOnly") flags set) remains intact and untouched by non-secure 73 subdomains. 75 We can't alter the syntax of the "Cookie" request header, as that 76 would likely break a number of implementations. This rules out 77 sending a cookie's flags along with the cookie directly, but we can 78 smuggle information along with the cookie if we reserve certain name 79 prefixes for cookies with certain properties. 81 This document describes such a scheme, which enables servers to set 82 cookies which conforming user agents will ensure are "Secure", and 83 locked to a domain. 85 2. Terminology and notation 87 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 88 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 89 document are to be interpreted as described in [RFC2119]. 91 The "scheme" component of a URI is defined in Section 3 of [RFC3986]. 93 3. Prefixes 95 3.1. The "$Secure-" prefix 97 If a cookie's name begins with "$Secure-", the cookie MUST be set 98 with a "Secure" attribute. 100 The following cookie would be rejected: 102 Set-Cookie: $Secure-SID=12345; Domain=example.com 104 While the following would be accepted: 106 Set-Cookie: $Secure-SID=12345; Secure; Domain=example.com 108 3.2. The "$Origin-" prefix 110 If a cookie's name begins with "$Origin-", the cookie MUST be: 112 1. Sent only to hosts which are identical to the host which set the 113 cookie. That is, a cookie named "$Origin-cookie1" set from 114 "https://example.com" MUST NOT contain a "Domain" attribute (and 115 will therefore sent only to "example.com", and not to 116 "subdomain.example.com"). 118 2. Sent to every request for a host. That is, a cookie named 119 "$Origin-cookie1" MUST contain a "Path" attribute with a value of 120 "/". 122 3. Sent only to secure origins, if set from a secure origin. That 123 is, a cookie named "$Origin-cookie1" set from 124 "https://example.com" MUST contain a "Secure" attribute, as it 125 was set from a URI whose "scheme" is considered "secure" by the 126 user agent. 128 The following cookies would always be rejected: 130 Set-Cookie: $Origin-SID=12345 131 Set-Cookie: $Origin-SID=12345; Secure 132 Set-Cookie: $Origin-SID=12345; Domain=example.com 133 Set-Cookie: $Origin-SID=12345; Secure; Domain=example.com 135 The following would be rejected, if set from a secure origin, but 136 accepted if set from a non-secure origin: 138 Set-Cookie: $Origin-SID=12345; Path=/ 140 While the following would be accepted, if set from a secure origin: 142 Set-Cookie: $Origin-SID=12345; Secure; Path=/ 144 4. User Agent Requirements 146 This document updates Section 5.3 of [RFC6265] as follows: 148 After step 10 of the current algorithm, the cookies flags are set. 149 Insert the following steps to perform the prefix checks this document 150 specifies: 152 1. If the "cookie-name" begins with the string "$Origin-", then: 154 1. If the "scheme" component of the "request-uri" denotes a 155 "secure" protocol (as determined by the user agent), and the 156 cookie's "secure-only-flag" is "false", abort these steps and 157 ignore the cookie entirely. 159 2. If the cookie's "host-only-flag" is "false", abort these 160 steps and ignore the cookie entirely. 162 3. If the cookie's "path" is not "/", abort these steps and 163 ignore the cookie entirely. 165 2. If the "cookie-name" begins with the string "$Secure-", and the 166 cookie's "secure-only-flag" is "false", abort these steps and 167 ignore the cookie entirely. 169 5. Aesthetic Considerations 171 Prefixes are ugly. :( 173 6. Security Considerations 175 This scheme gives no assurance to the server that the restrictions on 176 cookie names are enforced. Servers could certainly probe the user 177 agent's functionality to determine support, or sniff based on the 178 "User-Agent" request header, if such assurances were deemed 179 necessary. 181 7. Normative References 183 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 184 Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/ 185 RFC2119, March 1997, 186 . 188 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 189 Resource Identifier (URI): Generic Syntax", STD 66, RFC 190 3986, DOI 10.17487/RFC3986, January 2005, 191 . 193 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, 194 DOI 10.17487/RFC6265, April 2011, 195 . 197 Appendix A. Acknowledgements 199 Eric Lawrence had this idea a million years ago. Devdatta Akhawe 200 helped justify the potential impact of the scheme on real-world 201 websites. 203 Author's Address 205 Mike West 206 Google, Inc 208 Email: mkwst@google.com 209 URI: https://mikewest.org/