@@ -351,9 +351,8 @@ A domain's "public suffix" is the portion of a domain that is controlled by a
351351public registry, such as "com", "co.uk", and "pvt.k12.wy.us". A domain's
352352" registrable domain" is the domain's public suffix plus the label to its left.
353353That is, for `https://www.site.example`, the public suffix is `example`, and the
354- registrable domain is `site.example`. Whenever possible, user agents SHOULD
355- use an up-to-date public suffix list, such as the one maintained by the Mozilla
356- project at {{PSL}}.
354+ registrable domain is `site.example`. See {{public-suffix-list-security}} for security
355+ considerations.
357356
358357The term "request", as well as a request's "client", "current url", "method",
359358" target browsing context" , and "url list", are defined in {{FETCH}}.
@@ -364,6 +363,17 @@ cookies, such as a web browser API that exposes cookies to scripts.
364363The term "top-level navigation" refers to a navigation of a top-level
365364traversable.
366365
366+ # # Name Resolution System
367+
368+ While this document does not strictly prescribe any specific name resolution
369+ system for use with cookies it does require that the system uses only
370+ {{USASCII}} characters or uses an ASCII-compatible encoding (ACE). As the Domain
371+ Name System (DNS) is a typical and conventional example this document will
372+ reference name resolution in terms of DNS.
373+
374+ Name resolution systems that directly expose non-ASCII characters, such as
375+ Unicode, are out of scope of this document.
376+
367377# Overview
368378
369379This section outlines a way for an origin server to send state information to a
@@ -737,11 +747,10 @@ user agent).
737747
738748The Domain attribute specifies those hosts to which the cookie will be sent.
739749For example, if the value of the Domain attribute is "site.example", the user
740- agent will include the cookie in the Cookie header field when making HTTP requests to
741- site.example, www.site.example, and www.corp.site.example. (Note that a
742- leading %x2E ("."), if present, is ignored even though that character is not
743- permitted.) If the server omits the Domain attribute, the user agent
744- will return the cookie only to the origin server.
750+ agent will include the cookie in the Cookie header field when making HTTP
751+ requests to site.example, www.site.example, and www.corp.site.example. If the
752+ server omits the Domain attribute, the user agent will return the cookie only
753+ to the origin server.
745754
746755WARNING : Some existing user agents treat an absent Domain attribute as if the
747756Domain attribute were present and contained the current host name. For
@@ -1051,12 +1060,20 @@ A canonicalized host name is the string generated by the following algorithm:
10511060
105210611. Convert the host name to a sequence of individual domain name labels.
10531062
1054- 2. Convert each label that is not a Non-Reserved LDH (NR-LDH) label, to an
1055- A-label (see {{Section 2.3.2.1 of RFC5890}} for the former and latter).
1063+ 2. All labels must be one of U-label, A-label, or Non-Reserved LDH (NR-LDH)
1064+ label (see {{Section 2.3.1 of RFC5890}}). If any label is not one of these
1065+ then abort this algorithm and fail to canonicalize the host name.
1066+
1067+ 3. Convert each U-label to an A-label (see {{Section 2.3.2.1 of RFC5890}}).
10561068
1057- 3. Concatenate the resulting labels, separated by a %x2E (".") character.
1069+ 4. If any label is a Fake A-label then abort this algorithm and fail to
1070+ canonicalize the host name.
10581071
1059- # ## Domain Matching
1072+ 5. Concatenate the resulting labels, separated by a %x2E (".") character.
1073+
1074+ # ## Domain Matching {#domain-matching}
1075+
1076+ Note : This algorithm expects that both inputs are canonicalized.
10601077
10611078A string domain-matches a given domain string if at least one of the following
10621079conditions hold :
@@ -1688,8 +1705,12 @@ user agent MUST process the cookie as follows:
168817059. If the user agent is configured to reject "public suffixes" and the
16891706 domain-attribute is a public suffix :
16901707
1691- 1. If the domain-attribute is identical to the canonicalized
1692- request-host :
1708+ 1. Let request-host-canonical be the canonicalized request-host.
1709+
1710+ 2. If request-host fails to be canonicalized then abort this algorithm and
1711+ ignore the cookie entirely.
1712+
1713+ 3. If the domain-attribute is identical to the request-host-canonical :
16931714
16941715 1. Let the domain-attribute be the empty string.
16951716
@@ -1702,8 +1723,8 @@ user agent MUST process the cookie as follows:
17021723
1703172410. If the domain-attribute is non-empty :
17041725
1705- 1. If the canonicalized request-host does not domain-match the
1706- domain-attribute :
1726+ 1. If request-host-canonical does not domain-match
1727+ (see {{domain-matching}}) the domain-attribute :
17071728
17081729 1. Abort this algorithm and ignore the cookie entirely.
17091730
@@ -1717,7 +1738,7 @@ user agent MUST process the cookie as follows:
17171738
17181739 1. Set the cookie's host-only-flag to true.
17191740
1720- 2. Set the cookie's domain to the canonicalized request-host.
1741+ 2. Set the cookie's domain to request-host-canonical .
17211742
1722174311. If the cookie-attribute-list contains an attribute with an
17231744 attribute-name of "Path", set the cookie's path to attribute-value of
@@ -1751,8 +1772,8 @@ user agent MUST process the cookie as follows:
17511772
17521773 2. Their secure-only-flag is true.
17531774
1754- 3. Their domain domain-matches the domain of the newly-created cookie, or
1755- vice-versa.
1775+ 3. Their domain domain-matches (see {{ domain-matching}}) the domain of the
1776+ newly-created cookie, or vice-versa.
17561777
17571778 4. The path of the newly-created cookie path-matches the path of the
17581779 existing cookie.
@@ -1926,18 +1947,23 @@ is "non-HTTP".
19261947Given a cookie store and a retrieval, the following algorithm returns a
19271948cookie-string from a given cookie store.
19281949
1929- 1. Let cookie-list be the set of cookies from the cookie store that meets all
1950+ 1. Let retrieval-host-canonical be the canonicalized host of the retrieval's URI.
1951+
1952+ 2. If the host of the retrieval's URI fails to be canonicalized then abort this
1953+ algorithm.
1954+
1955+ 3. Let cookie-list be the set of cookies from the cookie store that meets all
19301956 of the following requirements :
19311957
19321958 * Either:
19331959
1934- * The cookie's host-only-flag is true and the canonicalized
1935- host of the retrieval's URI is identical to the cookie's domain.
1960+ * The cookie's host-only-flag is true and retrieval-host-canonical is
1961+ identical to the cookie's domain.
19361962
19371963 Or :
19381964
1939- * The cookie's host-only-flag is false and the canonicalized
1940- host of the retrieval's URI domain-matches the cookie's domain.
1965+ * The cookie's host-only-flag is false and retrieval-host-canonical
1966+ domain-matches (see {{ domain-matching}}) the cookie's domain.
19411967
19421968 * The cookie's domain is not a public suffix, for user agents configured
19431969 to reject "public suffixes".
@@ -1971,7 +1997,7 @@ cookie-string from a given cookie store.
19711997 * The target browsing context of the HTTP request associated with the
19721998 retrieval is the active browsing context or a top-level traversable.
19731999
1974- 2 . The user agent SHOULD sort the cookie-list in the following order :
2000+ 4 . The user agent SHOULD sort the cookie-list in the following order :
19752001
19762002 * Cookies with longer paths are listed before cookies with shorter
19772003 paths.
@@ -1983,10 +2009,10 @@ cookie-string from a given cookie store.
19832009 reflects common practice when this document was written, and, historically,
19842010 there have been servers that (erroneously) depended on this order.
19852011
1986- 3 . Update the last-access-time of each cookie in the cookie-list to the
2012+ 5 . Update the last-access-time of each cookie in the cookie-list to the
19872013 current date and time.
19882014
1989- 4 . Serialize the cookie-list into a cookie-string by processing each cookie
2015+ 6 . Serialize the cookie-list into a cookie-string by processing each cookie
19902016 in the cookie-list in order :
19912017
19922018 1. If the cookies' name is not empty, output the cookie's name followed by
@@ -2471,6 +2497,17 @@ necessarily provides fewer protections against CSRF. Ultimately, the provision
24712497of such an enforcement mode should be seen as a temporary, transitional measure
24722498to ease adoption of "Lax" enforcement by default.
24732499
2500+ # # Public Suffix List {#public-suffix-list-security}
2501+
2502+ The boundaries of cookies depend on a site's "registrable domain" which in turn
2503+ depends on the public suffix of the domain.
2504+
2505+ Whenever possible, user agents SHOULD use an up-to-date public suffix list,
2506+ such as the one maintained by the Mozilla project at {{PSL}}.
2507+
2508+ Failure to do so could allow malicious or sensitive cookies to leak between
2509+ registrable domains.
2510+
24742511# IANA Considerations
24752512
24762513# # Cookie {#iana-cookie}
0 commit comments