idnits 2.17.1 draft-west-cookie-prefixes-02.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 9, 2015) is 3122 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 9, 2015 5 Intended status: Standards Track 6 Expires: April 11, 2016 8 Cookie Prefixes 9 draft-west-cookie-prefixes-02 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 11, 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 3.3. The "$SecureOrigin-" prefix . . . . . . . . . . . . . . . 4 60 4. User Agent Requirements . . . . . . . . . . . . . . . . . . . 4 61 5. Aesthetic Considerations . . . . . . . . . . . . . . . . . . 5 62 6. Security Considerations . . . . . . . . . . . . . . . . . . . 5 63 7. Normative References . . . . . . . . . . . . . . . . . . . . 5 64 Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 5 65 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 5 67 1. Introduction 69 Section 8.5 and Section 8.6 of [RFC6265] spell out some of the 70 drawbacks of cookies' implementation: due to historical accident, it 71 is impossible for a server to have confidence that a cookie set in a 72 secure way (e.g., as a domain cookie with the "Secure" (and possibly 73 "HttpOnly") flags set) remains intact and untouched by non-secure 74 subdomains. 76 We can't alter the syntax of the "Cookie" request header, as that 77 would likely break a number of implementations. This rules out 78 sending a cookie's flags along with the cookie directly, but we can 79 smuggle information along with the cookie if we reserve certain name 80 prefixes for cookies with certain properties. 82 This document describes such a scheme, which enables servers to set 83 cookies which conforming user agents will ensure are "Secure", and 84 locked to a domain. 86 2. Terminology and notation 88 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 89 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 90 document are to be interpreted as described in [RFC2119]. 92 The "scheme" component of a URI is defined in Section 3 of [RFC3986]. 94 3. Prefixes 96 3.1. The "$Secure-" prefix 98 If a cookie's name begins with "$Secure-", the cookie MUST be set 99 with a "Secure" attribute. 101 The following cookie would be rejected: 103 Set-Cookie: $Secure-SID=12345; Domain=example.com 105 While the following would be accepted: 107 Set-Cookie: $Secure-SID=12345; Secure; Domain=example.com 109 3.2. The "$Origin-" prefix 111 If a cookie's name begins with "$Origin-", the cookie MUST be: 113 1. Sent only to hosts which are identical to the host which set the 114 cookie. That is, a cookie named "$Origin-cookie1" set from 115 "https://example.com" MUST NOT contain a "Domain" attribute (and 116 will therefore sent only to "example.com", and not to 117 "subdomain.example.com"). 119 2. Sent to every request for a host. That is, a cookie named 120 "$Origin-cookie1" MUST contain a "Path" attribute with a value of 121 "/". 123 3. Sent only to secure origins, if set from a secure origin. That 124 is, a cookie named "$Origin-cookie1" set from 125 "https://example.com" MUST contain a "Secure" attribute, as it 126 was set from a URI whose "scheme" is considered "secure" by the 127 user agent. 129 The following cookies would always be rejected: 131 Set-Cookie: $Origin-SID=12345 132 Set-Cookie: $Origin-SID=12345; Secure 133 Set-Cookie: $Origin-SID=12345; Domain=example.com 134 Set-Cookie: $Origin-SID=12345; Secure; Domain=example.com 136 The following would be rejected, if set from a secure origin, but 137 accepted if set from a non-secure origin: 139 Set-Cookie: $Origin-SID=12345; Path=/ 141 While the following would be accepted, if set from a secure origin: 143 Set-Cookie: $Origin-SID=12345; Secure; Path=/ 145 3.3. The "$SecureOrigin-" prefix 147 If a cookie's name begins with "$SecureOrigin-", the cookie MUST be: 149 1. Sent only to hosts which are identical to the host which set the 150 cookie. That is, a cookie named "$SecureOrigin-cookie1" set from 151 "https://example.com" MUST NOT contain a "Domain" attribute (and 152 will therefore sent only to "example.com", and not to 153 "subdomain.example.com"). 155 2. Sent to every request for a host. That is, a cookie named 156 "$SecureOrigin-cookie1" MUST contain a "Path" attribute with a 157 value of "/". 159 3. Sent only to secure origins. That is, a cookie named 160 "$SecureOrigin-cookie1" MUST contain a "Secure" attribute. 162 4. User Agent Requirements 164 This document updates Section 5.3 of [RFC6265] as follows: 166 After step 10 of the current algorithm, the cookies flags are set. 167 Insert the following steps to perform the prefix checks this document 168 specifies: 170 1. If the "cookie-name" begins with the string "$Origin-", then: 172 1. If the "scheme" component of the "request-uri" denotes a 173 "secure" protocol (as determined by the user agent), and the 174 cookie's "secure-only-flag" is "false", abort these steps and 175 ignore the cookie entirely. 177 2. If the cookie's "host-only-flag" is "false", abort these 178 steps and ignore the cookie entirely. 180 3. If the cookie's "path" is not "/", abort these steps and 181 ignore the cookie entirely. 183 2. If the "cookie-name" begins with the string "$Secure-", and the 184 cookie's "secure-only-flag" is "false", abort these steps and 185 ignore the cookie entirely. 187 3. If the "cookie-name" begins with the string "$SecureOrigin-", 188 then: 190 1. If the cookie's "secure-only-flag" is "false", abort these 191 steps and ignore the cookie entirely. 193 2. If the cookie's "host-only-flag" is "false", abort these 194 steps and ignore the cookie entirely. 196 3. If the cookie's "path" is not "/", abort these steps and 197 ignore the cookie entirely. 199 5. Aesthetic Considerations 201 Prefixes are ugly. :( 203 6. Security Considerations 205 This scheme gives no assurance to the server that the restrictions on 206 cookie names are enforced. Servers could certainly probe the user 207 agent's functionality to determine support, or sniff based on the 208 "User-Agent" request header, if such assurances were deemed 209 necessary. 211 7. Normative References 213 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 214 Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/ 215 RFC2119, March 1997, 216 . 218 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 219 Resource Identifier (URI): Generic Syntax", STD 66, RFC 220 3986, DOI 10.17487/RFC3986, January 2005, 221 . 223 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, 224 DOI 10.17487/RFC6265, April 2011, 225 . 227 Appendix A. Acknowledgements 229 Eric Lawrence had this idea a million years ago. Devdatta Akhawe 230 helped justify the potential impact of the scheme on real-world 231 websites. 233 Author's Address 234 Mike West 235 Google, Inc 237 Email: mkwst@google.com 238 URI: https://mikewest.org/