From aef5c9d279154401c22bc71105542b9b2c3c37c0 Mon Sep 17 00:00:00 2001
From: Benjamin VanderSloot A request has an associated
+top-level navigation initiator origin, which is
+an origin or null. Unless stated otherwise it is null.
+
" A request request has a
-redirect-tainted origin if these steps
-return true:
+ A request has a redirect-taint,
+which is " To get request request's redirect-taint:
Assert: request's origin is not
@@ -2236,6 +2258,8 @@ return true:
Let lastURL be null.
+ Let crossOriginTaint be " For each url of request's URL list:
@@ -2243,14 +2267,19 @@ return true:
If lastURL is null, then set lastURL to url and
continue.
+ If url's origin is not same site with
+ lastURL's origin and request's origin is
+ not same site with lastURL's origin, then return " If url's origin is not same origin with
lastURL's origin and request's origin is
- not same origin with lastURL's origin, then return true.
+ not same origin with lastURL's origin,
+ then let crossOriginTaint be " If request has a redirect-tainted origin, then return
- " If request's redirect-taint is not " Return request's origin,
serialized.
@@ -2372,8 +2401,8 @@ source of security bugs. Please seek security review for features that deal with
" If request's origin is same origin with
- request's current URL's origin and request
- does not have a redirect-tainted origin, then return true.
{
+ "COOKIES": {
+ "authors": ["Johann Hofmann", "Anne Van Kesteren"],
+ "href": "https://www.ietf.org/archive/id/draft-annevk-johannhof-httpbis-cookies-00.html",
+ "title": "Cookies: HTTP State Management Mechanism"
+ },
"HTTP": {
"aliasOf": "RFC9110"
},
@@ -1938,6 +1956,10 @@ not always relevant and might require different behavior.
"
client
" or an origin. Unless stated otherwise it is
"client
".
+client
" is changed to an origin during
fetching. It provides a convenient way for standards to not have to set
request's origin.
@@ -2226,9 +2248,9 @@ or "object
".
None
", "Cross-Origin
", or "Cross-Site
".
+
- None
".
+
Cross-Site
".
+
Cross-Origin
"..
null
".
+ None
",
+ then return "null
".
credentialless
", then return true.None
", then return true.
Return false.
@@ -2489,6 +2518,9 @@ this is also tracked internally using the request's timing allowA response has an associated has-cross-origin-redirects (a boolean), which is initially false. +
A response has an associated has-cross-site-redirects +(a boolean), which is initially false. +
A network error is a response whose @@ -3292,6 +3324,72 @@ through TLS using ALPN. The protocol cannot be spoofed through HTTP requests in
Cookie
` headerThe `Cookie
`
+request header allows the request to carry locally stored state, such as user credentials.
+
+
To append a request `Cookie
` header,
+given a request request, run these steps:
+
Let |sameSite| be the result of [=determining the same-site mode=] for request. +
Let |isSecure| be false. +
If request's client is a secure context, then set |isSecure| to true. +
Let |httpOnlyAllowed| be true. +
Fetch implies that the request is http-only, as opposed to document.cookie +
Let |cookies| be the result of running retrieve cookies given + |isSecure|, + request's current URL's host, + request's current URL's path, + |httpOnlyAllowed|, and + |sameSite| + +
It is expected that the cookie store returns an ordered list of cookies +
Cookie
`, value) to request's header list.
+ To parse and store response `Set-Cookie
` headers,
+given a request request and a response response, run these steps:
+
Let |allowNonHostOnlyCookieForPublicSuffix| be false. +
Let |isSecure| be false. +
If request's client is a secure context, then set |isSecure| to true. +
Let |httpOnlyAllowed| be true. +
Fetch implies that the request is http-only, as opposed to document.cookie +
Let |sameSiteStrictOrLaxAllowed| be true if the result of [=determine the same-site mode=] for |request| is "StrictOrLess
", and false otherwise.
+
For each header of response's header list: +
If header's name is not a byte-case-insensitive match for `Set-Cookie
`, then continue.
+
Parse and store a cookie given + header's value, + |isSecure|, + request's current URL's host, + request's current URL's path, + |httpOnlyAllowed|, + |allowNonHostOnlyCookieForPublicSuffix|, and + |sameSiteStrictOrLaxAllowed| +
To determine the same-site mode for a given request request, run these steps: +
If request's top-level navigation initiator origin is not null and is not same site to request's URL's origin, return "UnsetOrLess
".
+
If request's method is "GET" and
+ request's destination is "document", return "LaxOrLess
".
+
If request's client's ancestry is "cross-site
", return "UnsetOrLess
".
+
If request's redirect-taint is "Cross-Site
", return "UnsetOrLess
".
+
Return "StrictOrLess". +
Origin
` headerThe `Origin
`
@@ -4680,9 +4778,12 @@ steps:
-
If request has a redirect-tainted origin, then set +
If request's redirect-taint is not "None
", then set
internalResponse's has-cross-origin-redirects to true.
+
If request's redirect-taint is "Cross-Site
", then set
+ internalResponse's has-cross-site-redirects to true.
+
If request's timing allow failed flag is unset, then set internalResponse's timing allow passed flag. @@ -5710,21 +5811,9 @@ run these steps:
If includeCredentials is true, then:
If the user agent is not configured to block cookies for httpRequest (see - section 7 of - [[!COOKIES]]), then: +
This permits some implementations to choose to not support cookies for some or all httpRequests. -
Let cookies be the result of running the "cookie-string" algorithm (see - section 5.4 of - [[!COOKIES]]) with the user agent's cookie store and httpRequest's - current URL. - -
Cookie
`, cookies) to httpRequest's
- header list.
- The user agent should append a request `Cookie
` header for httpRequest.
If httpRequest's header list @@ -6288,14 +6377,7 @@ optional boolean forceNewConnection (default false), run these steps:
If includeCredentials is true and the user agent is not
- configured to block cookies for request (see
- section 7 of
- [[!COOKIES]]), then run the "set-cookie-string" parsing algorithm (see
- section 5.2 of [[!COOKIES]]) on the
- value of each header whose name is a
- byte-case-insensitive match for `Set-Cookie
` in response's
- header list, if any, and request's current URL.
+
If includeCredentials is true, the user agent should parse and store response `Set-Cookie
` headers given request and response.
Run these steps in parallel:
From 7a6a1feb818e121da5e6ad1c3f6d6baafa1415e3 Mon Sep 17 00:00:00 2001
From: bvandersloot-mozilla
<90582190+bvandersloot-mozilla@users.noreply.github.com>
Date: Mon, 10 Mar 2025 12:03:10 -0400
Subject: [PATCH 2/5] apologies for American
Co-authored-by: Anne van Kesteren To append a request ` Let |sameSite| be the result of [=determining the same-site mode=] for request.
Let |isSecure| be false.
@@ -3347,7 +3347,7 @@ given a request request, run these steps:
It is expected that the cookie store returns an ordered list of cookies
A request has a redirect-taint,
-which is " To get request request's redirect-taint:
Let lastURL be null.
- Let crossOriginTaint be " Let computedTaint be " For each url of request's URL list:
@@ -2269,17 +2269,17 @@ which is " If url's origin is not same site with
lastURL's origin and request's origin is
- not same site with lastURL's origin, then return " If url's origin is not same origin with
lastURL's origin and request's origin is
not same origin with lastURL's origin,
- then let crossOriginTaint be " If request's redirect-taint is not " If request's redirect-taint is not " Return request's origin,
@@ -2402,7 +2402,7 @@ source of security bugs. Please seek security review for features that deal with
If request's origin is same origin with
request's current URL's origin and request's
- redirect-taint is not "
{
"COOKIES": {
- "authors": ["Johann Hofmann", "Anne Van Kesteren"],
+ "authors": ["Johann Hofmann", "Anne van Kesteren"],
"href": "https://www.ietf.org/archive/id/draft-annevk-johannhof-httpbis-cookies-00.html",
"title": "Cookies: HTTP State Management Mechanism"
},
From c79ead3ffd0be87be7e521a1d731c8378799d2c3 Mon Sep 17 00:00:00 2001
From: bvandersloot-mozilla
<90582190+bvandersloot-mozilla@users.noreply.github.com>
Date: Mon, 10 Mar 2025 14:48:30 -0400
Subject: [PATCH 3/5] Apply suggestions from code review
Co-authored-by: Anne van Kesteren
Cookie
` header,
-given a request request, run these steps:
+given a request request:
Cookie
`, value) to request's header list.
object
".
None
", "Cross-Origin
", or "Cross-Site
".
+which is "same-origin
", "same-site
", or "cross-site
".
@@ -2258,7 +2258,7 @@ which is "
- None
", "Cross-Origin
", or "Cross-Site<
None
".
+ same-origin
".
None
", "Cross-Origin
", or "Cross-Site<
Cross-Site
".
+ not same site with lastURL's origin, then return "cross-site
".
Cross-Origin
"..
+ then set computedTaint to "same-site
".
None
",
+ same-origin
",
then return "null
".
None
", then return true.same-origin
", then return true.
Return false.
A response has an associated has-cross-origin-redirects -(a boolean), which is initially false. - -
A response has an associated has-cross-site-redirects -(a boolean), which is initially false. +
A response has an associated redirect taint ("same-origin
",
+"same-site
", or "cross-site
", which is initially "same-origin
".
Cookie
` headerThe `Cookie
`
-request header allows the request to carry locally stored state, such as user credentials.
-
-
To append a request `Cookie
` header,
-given a request request:
-
Let |sameSite| be the result of [=determining the same-site mode=] for request. -
Let |isSecure| be false. -
If request's client is a secure context, then set |isSecure| to true. -
Let |httpOnlyAllowed| be true. -
Fetch implies that the request is http-only, as opposed to document.cookie -
Let |cookies| be the result of running retrieve cookies given - |isSecure|, - request's current URL's host, - request's current URL's path, - |httpOnlyAllowed|, and - |sameSite| - -
It is expected that the cookie store returns an ordered list of cookies -
Cookie
`, value) to request's header list.
- To parse and store response `Set-Cookie
` headers,
-given a request request and a response response, run these steps:
-
Let |allowNonHostOnlyCookieForPublicSuffix| be false. -
Let |isSecure| be false. -
If request's client is a secure context, then set |isSecure| to true. -
Let |httpOnlyAllowed| be true. -
Fetch implies that the request is http-only, as opposed to document.cookie -
Let |sameSiteStrictOrLaxAllowed| be true if the result of [=determine the same-site mode=] for |request| is "StrictOrLess
", and false otherwise.
-
For each header of response's header list: -
If header's name is not a byte-case-insensitive match for `Set-Cookie
`, then continue.
-
Parse and store a cookie given - header's value, - |isSecure|, - request's current URL's host, - request's current URL's path, - |httpOnlyAllowed|, - |allowNonHostOnlyCookieForPublicSuffix|, and - |sameSiteStrictOrLaxAllowed| -
To determine the same-site mode for a given request request, run these steps: -
If request's top-level navigation initiator origin is not null and is not same site to request's URL's origin, return "UnsetOrLess
".
-
If request's method is "GET" and
- request's destination is "document", return "LaxOrLess
".
-
If request's client's ancestry is "cross-site
", return "UnsetOrLess
".
-
If request's redirect-taint is "Cross-Site
", return "UnsetOrLess
".
-
Return "StrictOrLess". -
Origin
` headerThe `Origin
`
@@ -4323,7 +4254,75 @@ indicates the request’s purpose is to fetch a resource that is anticipated to
The server can use this to adjust the caching expiry for prefetches, to disallow the prefetch, or to treat it differently when counting page visits. +
Cookie
` headerThe `Cookie
` header is largely defined in its own specification. [[COOKIES]].
+We define infrastructure to be able to use conveniently here.
+
+
To append a request `Cookie
` header,
+given a request request, run these steps:
+
If the user-agent is configured to disable cookies for request, it should return. +
Let |sameSite| be the result of [=determining the same-site mode=] for request. +
Let |isSecure| be false. +
If request's client is a secure context, then set |isSecure| to true. +
Let |httpOnlyAllowed| be true. +
Fetch implies that the request is http-only, as opposed to document.cookie +
Let |cookies| be the result of running retrieve cookies given + |isSecure|, + request's current URL's host, + request's current URL's path, + |httpOnlyAllowed|, and + |sameSite| + +
It is expected that the cookie store returns an ordered list of cookies +
Cookie
`, value) to request's header list.
+ To parse and store response `Set-Cookie
` headers,
+given a request request and a response response, run these steps:
+
If the user-agent is configured to disable cookies for request, it should return. +
Let |allowNonHostOnlyCookieForPublicSuffix| be false. +
Let |isSecure| be false. +
If request's client is a secure context, then set |isSecure| to true. +
Let |httpOnlyAllowed| be true. +
Fetch implies that the request is http-only, as opposed to document.cookie +
Let |sameSiteStrictOrLaxAllowed| be true if the result of [=determine the same-site mode=] for |request| is "StrictOrLess
", and false otherwise.
+
For each header of response's header list: +
If header's name is not a byte-case-insensitive match for `Set-Cookie
`, then continue.
+
Parse and store a cookie given + header's value, + |isSecure|, + request's current URL's host, + request's current URL's path, + |httpOnlyAllowed|, + |allowNonHostOnlyCookieForPublicSuffix|, and + |sameSiteStrictOrLaxAllowed| +
To determine the same-site mode for a given request request, run these steps: +
If request's top-level navigation initiator origin is not null and is not same site to request's URL's origin, return "UnsetOrLess
".
+
If request's method is "GET" and
+ request's destination is "document", return "LaxOrLess
".
+
If request's client's ancestry is "cross-site
", return "UnsetOrLess
".
+
If request's redirect-taint is "cross-site
", return "UnsetOrLess
".
+
Return "StrictOrLess". +
If request's redirect-taint is not "None
", then set
- internalResponse's has-cross-origin-redirects to true.
-
-
If request's redirect-taint is "Cross-Site
", then set
- internalResponse's has-cross-site-redirects to true.
+
Set internalResponse's redirect taint to request's + redirect-taint.
If request's timing allow failed flag is unset, then set internalResponse's timing allow passed flag. @@ -4935,7 +4931,7 @@ steps:
If fetchParams's request's mode is
not "navigate
" or response's
- has-cross-origin-redirects is false:
+ redirect taint is "same-origin
":
Set responseStatus to response's status. @@ -5811,9 +5807,7 @@ run these steps:
If includeCredentials is true, then:
This permits some implementations to choose to not support cookies for some or all httpRequests. - -
The user agent should append a request `Cookie
` header for httpRequest.
+
Append a request `Cookie
` header for httpRequest.
If httpRequest's header list
From fb5a26a3046da1d81a9e293dacc4d4fc432bc3d1 Mon Sep 17 00:00:00 2001
From: Benjamin VanderSloot A request has an associated
-top-level navigation initiator origin, which is
-an origin or null. Unless stated otherwise it is null.
+top-level navigation
+initiator origin, which is an origin or null. Unless stated otherwise it is null.
" If url's origin is not same site with
lastURL's origin and request's origin is
- not same site with lastURL's origin, then return " If url's origin is not same origin with
lastURL's origin and request's origin is
- not same origin with lastURL's origin,
- then set computedTaint to "client
".
client
" is changed to an origin during
fetching. It provides a convenient way for standards to not have to set
@@ -2269,12 +2269,13 @@ which is "same-origin
", "same-site
", or "cross-s
cross-site
".
+ not same site with lastURL's origin, then return
+ "cross-site
".
same-site
".
+ not same origin with lastURL's origin, then set
+ computedTaint to "same-site
".
A response has an associated redirect taint ("same-origin
",
-"same-site
", or "cross-site
", which is initially "same-origin
".
+
A response has an associated redirect taint
+("same-origin
", "same-site
", or "cross-site
", which is
+initially "same-origin
".
Cookie
` headerThe `Cookie
` header is largely defined in its own specification. [[COOKIES]].
-We define infrastructure to be able to use conveniently here.
+We define infrastructure to be able to use them conveniently here.
To append a request `Cookie
` header,
given a request request, run these steps:
-
If the user-agent is configured to disable cookies for request, it should return. -
Let |sameSite| be the result of [=determining the same-site mode=] for request. -
Let |isSecure| be false. -
If request's client is a secure context, then set |isSecure| to true. -
Let |httpOnlyAllowed| be true. -
Fetch implies that the request is http-only, as opposed to document.cookie -
Let |cookies| be the result of running retrieve cookies given - |isSecure|, - request's current URL's host, - request's current URL's path, - |httpOnlyAllowed|, and - |sameSite| - -
It is expected that the cookie store returns an ordered list of cookies -
Cookie
`, value) to request's header list.
- If the user-agent is configured to disable cookies for request, it should + return. + +
Let |sameSite| be the result of [=determining the same-site mode=] for request. + +
Let |isSecure| be false. + +
If request's client is a secure context, then set + |isSecure| to true. + +
Let |httpOnlyAllowed| be true. + +
Fetch implies that the request is http-only, as opposed to document.cookie + +
Let |cookies| be the result of running retrieve cookies given |isSecure|, + request's current URL's host, request's + current URL's path, |httpOnlyAllowed|, and |sameSite| + +
It is expected that the cookie store returns an ordered list of cookies + +
Cookie
`, value) to
+ request's header list.
+To parse and store response `Set-Cookie
` headers,
-given a request request and a response response, run these steps:
+
To parse and store response
+`Set-Cookie
` headers, given a request request and a response response, run these steps:
+
+
If the user-agent is configured to disable cookies for request, it should + return. + +
Let |allowNonHostOnlyCookieForPublicSuffix| be false. + +
Let |isSecure| be false. + +
If request's client is a secure context, set + |isSecure| to true. + +
Let |httpOnlyAllowed| be true. + +
Fetch implies that the request is http-only, as opposed to document.cookie + +
Let |sameSiteStrictOrLaxAllowed| be true if the result of [=determine the same-site mode=]
+ for |request| is "StrictOrLess
", and false otherwise.
+
+
For each header of response's header + list: +
If the user-agent is configured to disable cookies for request, it should return. -
Let |allowNonHostOnlyCookieForPublicSuffix| be false. -
Let |isSecure| be false. -
If request's client is a secure context, then set |isSecure| to true. -
Let |httpOnlyAllowed| be true. -
Fetch implies that the request is http-only, as opposed to document.cookie -
Let |sameSiteStrictOrLaxAllowed| be true if the result of [=determine the same-site mode=] for |request| is "StrictOrLess
", and false otherwise.
-
For each header of response's header list: -
If header's name is not a byte-case-insensitive match for `Set-Cookie
`, then continue.
-
Parse and store a cookie given - header's value, - |isSecure|, - request's current URL's host, - request's current URL's path, - |httpOnlyAllowed|, - |allowNonHostOnlyCookieForPublicSuffix|, and - |sameSiteStrictOrLaxAllowed| -
If header's name is not a byte-case-insensitive match
+ for `Set-Cookie
`, continue.
+
+
Parse and store a cookie given header's value, + |isSecure|, request's current URL's host, + request's current URL's path, |httpOnlyAllowed|, + |allowNonHostOnlyCookieForPublicSuffix|, and |sameSiteStrictOrLaxAllowed|
To determine the same-site mode for a given request request, run these steps: -
If request's top-level navigation initiator origin is not null and is not same site to request's URL's origin, return "UnsetOrLess
".
-
If request's method is "GET" and
- request's destination is "document", return "LaxOrLess
".
-
If request's client's ancestry is "cross-site
", return "UnsetOrLess
".
-
If request's redirect-taint is "cross-site
", return "UnsetOrLess
".
-
Return "StrictOrLess". -
To determine the same-site mode for a given request request, +run these steps: + +
If request's top-level navigation initiator origin is not
+ null and is not same site to request's URL's
+ origin, return "UnsetOrLess
".
+
+
If request's method is "GET" and request's destination is "document", return "LaxOrLess
".
+
+
If request's client's ancestry is
+ "cross-site
", return "UnsetOrLess
".
+
+
If request's redirect-taint is "cross-site
",
+ return "UnsetOrLess
".
+
+
Return "StrictOrLess". +
If includeCredentials is true, the user agent should parse and store response `Set-Cookie
` headers given request and response.
+
If includeCredentials is true, the user agent should parse and
+ store response `Set-Cookie
` headers given request and
+ response.
Run these steps in parallel: