@@ -54,10 +54,29 @@ urlPrefix:https://tc39.es/ecma262/#;type:dfn;spec:ecma-262
54
54
url:realm;text:realm
55
55
url:sec-list-and-record-specification-type;text:Record
56
56
url:current-realm;text:current realm
57
+
58
+ urlPrefix:https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-layered-cookies#;type:dfn;spec:cookies
59
+ url:name-cookie-store-and-limits;text:cookie store
60
+ url:name-parse-and-store-a-cookie;text:parse and store a cookie
61
+ url:name-parse-a-cookie;text:parse a cookie
62
+ url:name-store-a-cookie;text:store a cookie
63
+ url:name-retrieve-cookies;text:retrieve cookies
64
+ url:name-serialize-cookies;text:serialize cookies
65
+ url:name-garbage-collect-cookies;text:garbage collect cookies
66
+
67
+ <!-- TODO: pending HTML changes- ancestor enum (https://github.com/whatwg/html/pull/10559), has storage access bit, initiator origin plumbing -->
68
+ urlPrefix:https://html.spec.whatwg.org#;type:dfn;spec:html
69
+ url:TODO;text:has cross-site ancestor;for:environment
70
+ url:TODO;text:has storage access;for:environment
57
71
</pre>
58
72
59
73
<pre class=biblio>
60
74
{
75
+ "COOKIES": {
76
+ "authors": ["Johann Hofmann", "Anne van Kesteren"] ,
77
+ "href": "https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-layered-cookies",
78
+ "title": "Cookies: HTTP State Management Mechanism"
79
+ },
61
80
"HTTP": {
62
81
"aliasOf": "RFC9110"
63
82
},
@@ -1961,6 +1980,10 @@ not always relevant and might require different behavior.
1961
1980
"<code> client</code> " or an <a for=/>origin</a> . Unless stated otherwise it is
1962
1981
"<code> client</code> ".
1963
1982
1983
+ <p> A <a for=/>request</a> has an associated
1984
+ <dfn export for=request>top-level navigation initiator origin</dfn> ,
1985
+ which is an <a for=/>origin</a> or null. Unless stated otherwise it is null.
1986
+
1964
1987
<p class=note> "<code> client</code> " is changed to an <a for=/>origin</a> during
1965
1988
<a lt=fetch for=/>fetching</a> . It provides a convenient way for standards to not have to set
1966
1989
<a for=/>request</a> 's <a for=request>origin</a> .
@@ -2249,31 +2272,39 @@ or "<code>object</code>".
2249
2272
<hr>
2250
2273
2251
2274
<div algorithm>
2252
- <p> A <a for=/> request</a> <var> request</var> has a
2253
- <dfn for=request id=concept-request-tainted-origin>redirect-tainted origin</dfn> if these steps
2254
- return true:
2275
+ <p> To compute the <dfn for=request id=concept- request-tainted-origin>redirect-taint</dfn> of a
2276
+ <a for=/> request</a> <var> request </var> , perform the following steps. They return
2277
+ " <code> same-origin </code> ", " <code> same-site </code> ", or " <code> cross-site </code> ".
2255
2278
2256
2279
<ol>
2257
2280
<li><p> <a for=/>Assert</a> : <var> request</var> 's <a for=request>origin</a> is not
2258
2281
"<code> client</code> ".
2259
2282
2260
2283
<li><p> Let <var> lastURL</var> be null.
2261
2284
2285
+ <li><p> Let <var> computedTaint</var> be "<code> same-origin</code> ".
2286
+
2262
2287
<li>
2263
2288
<p> <a for=list>For each</a> <var> url</var> of <var> request</var> 's <a for=request>URL list</a> :
2264
2289
2265
2290
<ol>
2266
2291
<li><p> If <var> lastURL</var> is null, then set <var> lastURL</var> to <var> url</var> and
2267
2292
<a for=iteration>continue</a> .
2268
2293
2294
+ <li><p> If <var> url</var> 's <a for=url>origin</a> is not <a for=/>same site</a> with
2295
+ <var> lastURL</var> 's <a for=url>origin</a> and <var>request</var>' s <a for=request>origin</a> is
2296
+ not <a for=/>same site</a> with <var> lastURL</var> 's <a for=url>origin</a> , then return
2297
+ "<code> cross-site</code> ".
2298
+
2269
2299
<li><p> If <var> url</var> 's <a for=url>origin</a> is not <a>same origin</a> with
2270
2300
<var> lastURL</var> 's <a for=url>origin</a> and <var>request</var>' s <a for=request>origin</a> is
2271
- not <a>same origin</a> with <var> lastURL</var> 's <a for=url>origin</a> , then return true.
2301
+ not <a>same origin</a> with <var> lastURL</var> 's <a for=url>origin</a> , then set
2302
+ <var> computedTaint</var> to "<code> same-site</code> ".
2272
2303
2273
2304
<li> Set <var> lastURL</var> to <var> url</var> .
2274
2305
</ol>
2275
2306
2276
- <li> Return false .
2307
+ <li><p> Return <var> computedTaint </var> .
2277
2308
</ol>
2278
2309
</div>
2279
2310
@@ -2285,8 +2316,8 @@ run these steps:
2285
2316
<li><p> <a for=/>Assert</a> : <var> request</var> 's <a for=request>origin</a> is not
2286
2317
"<code> client</code> ".
2287
2318
2288
- <li><p> If <var> request</var> has a <a for=request>redirect-tainted origin </a> , then return
2289
- "<code> null</code> ".
2319
+ <li><p> If <var> request</var> 's <a for=request>redirect-taint </a> is not " <code> same-origin </code> ",
2320
+ then return "<code> null</code> ".
2290
2321
2291
2322
<li><p> Return <var> request</var> 's <a for=request>origin</a> ,
2292
2323
<a lt="ASCII serialization of an origin">serialized</a> .
@@ -2385,20 +2416,20 @@ source of security bugs. Please seek security review for features that deal with
2385
2416
"<code> client</code> ".
2386
2417
2387
2418
<li><p> If <var> request</var> 's <a for=request>mode</a> is not "<code> no-cors</code> ", then return
2388
- true.</p>
2419
+ true.
2389
2420
2390
- <li><p> If <var> request</var> 's <a for=request>client</a> is null, then return true.</p>
2421
+ <li><p> If <var> request</var> 's <a for=request>client</a> is null, then return true.
2391
2422
2392
2423
<li><p> If <var> request</var> 's <a for=request>client</a>' s
2393
2424
<a for="environment settings object">policy container</a> 's
2394
2425
<a for="policy container">embedder policy</a> 's <a for="embedder policy">value</a> is not
2395
- "<a for="embedder policy value"><code>credentialless</code></a> ", then return true.</p>
2426
+ "<a for="embedder policy value"><code>credentialless</code></a> ", then return true.
2396
2427
2397
2428
<li><p> If <var> request</var> 's <a for=request>origin</a> is <a>same origin</a> with
2398
- <var> request</var> 's <a for=request>current URL</a>' s <a for=url>origin</a> and <var> request</var>
2399
- does not have a <a for=request>redirect-tainted origin</a> , then return true.</p>
2429
+ <var> request</var> 's <a for=request>current URL</a>' s <a for=url>origin</a> and <var> request</var> 's
2430
+ <a for=request>redirect-taint</a> is not " <code> same- origin</code> " , then return true.
2400
2431
2401
- <li><p> Return false.</p>
2432
+ <li><p> Return false.
2402
2433
</ol>
2403
2434
</div>
2404
2435
@@ -2509,8 +2540,9 @@ this is also tracked internally using the request's <a for=request>timing allow
2509
2540
<dfn export for=response>service worker timing info</dfn> (null or a
2510
2541
<a for=/>service worker timing info</a> ), which is initially null.
2511
2542
2512
- <p> A <a for=/>response</a> has an associated <dfn for=response>has-cross-origin-redirects</dfn>
2513
- (a boolean), which is initially false.
2543
+ <p> A <a for=/>response</a> has an associated <dfn for=response>redirect taint</dfn>
2544
+ ("<code> same-origin</code> ", "<code> same-site</code> ", or "<code> cross-site</code> "), which is
2545
+ initially "<code> same-origin</code> ".
2514
2546
2515
2547
<hr>
2516
2548
@@ -4252,6 +4284,125 @@ prefetch, or to treat it differently when counting page visits.
4252
4284
4253
4285
4254
4286
4287
+ <h2 id=cookies>Cookies</h2>
4288
+
4289
+ <h3 id=cookie-header>`<code>Cookie</code>` header</h3>
4290
+
4291
+ <p> The `<code> Cookie</code> ` header is largely defined in its own specification. We define
4292
+ additional infrastructure to be able to use them conveniently here. [[COOKIES]] .
4293
+
4294
+ <div algorithm>
4295
+ <p> To <dfn>append a request `<code>Cookie</code>` header</dfn> ,
4296
+ given a <a for=/>request</a> <var> request</var> :
4297
+
4298
+ <ol>
4299
+ <li><p> If the user agent is configured to disable cookies for <var> request</var> , then it should
4300
+ return.
4301
+
4302
+ <li><p> Let |sameSite| be the result of [=determining the same-site mode=] for <var> request</var> .
4303
+
4304
+ <li><p> Let |isSecure| be false.
4305
+
4306
+ <li><p> If <var> request</var> 's <a for=request>client</a> is a <a>secure context</a> , then set
4307
+ |isSecure| to true.
4308
+
4309
+ <li>
4310
+ <p> Let |httpOnlyAllowed| be true.
4311
+
4312
+ <p class=note> True follows from this being invoked from <a>fetch</a> , as opposed to the
4313
+ <code> document.cookie</code> getter steps for instance.
4314
+
4315
+ <li>
4316
+ <p> Let |cookies| be the result of running <a>retrieve cookies</a> given |isSecure|,
4317
+ <var> request</var> 's <a for=request>current URL</a>' s <a for=url>host</a> , <var> request</var> 's
4318
+ <a for=request>current URL</a> 's <a for=url>path</a> , |httpOnlyAllowed|, and |sameSite|.
4319
+
4320
+ <p class=note> The cookie store returns an ordered list of cookies
4321
+
4322
+ <li><p> If |cookies| <a for="list">is empty</a> , then return.
4323
+
4324
+ <li><p> Let |value| be the result of running <a>serialize cookies</a> given |cookies|.
4325
+
4326
+ <li><p> <a for="header list">Append</a> (`<code> Cookie</code> `, <var> value</var> ) to
4327
+ <var> request</var> 's <a for=request>header list</a> .
4328
+ </ol>
4329
+ </div>
4330
+
4331
+ <div algorithm>
4332
+ <p> To
4333
+ <dfn>parse and store response `<code>Set-Cookie</code>` headers</dfn> ,
4334
+ given a <a for=/>request</a> <var> request</var> and a <a for=/>response</a> <var> response</var> :
4335
+
4336
+ <ol>
4337
+ <li><p> If the user agent is configured to disable cookies for <var> request</var> ,
4338
+ then it should return.
4339
+
4340
+ <li><p> Let |allowNonHostOnlyCookieForPublicSuffix| be false.
4341
+
4342
+ <li><p> Let |isSecure| be false.
4343
+
4344
+ <li><p> If <var> request</var> 's <a for=request>current URL</a>' s <a for=url>scheme</a> is
4345
+ "<code> https</code> ", then set |isSecure| to true.
4346
+
4347
+ <li>
4348
+ <p> Let |httpOnlyAllowed| be true.
4349
+
4350
+ <p class=note> True follows from this being invoked from <a>fetch</a> , as opposed to the
4351
+ <code> document.cookie</code> getter steps for instance.
4352
+
4353
+ <li><p> Let |sameSiteStrictOrLaxAllowed| be true if the result of [=determine the same-site mode=]
4354
+ for |request| is "<code> StrictOrLess</code> ", and false otherwise.
4355
+
4356
+ <li><p> <a for=list>For each</a> <var> header</var> of <var> response</var> 's
4357
+ <a for=response>header list</a> :
4358
+
4359
+ <ol>
4360
+ <li><p> If <var> header</var> 's <a for=header>name</a> is not a <a>byte-case-insensitive</a> match
4361
+ for `<code> Set-Cookie</code> `, <a for=iteration>continue</a> .
4362
+
4363
+ <li><p> <a>Parse and store a cookie</a> given <var> header</var> 's <a for=header>value</a> ,
4364
+ |isSecure|, <var> request</var> 's <a for=request>current URL</a>' s <a for=url>host</a> ,
4365
+ <var> request</var> 's <a for=request>current URL</a>' s <a for=url>path</a> , |httpOnlyAllowed|,
4366
+ |allowNonHostOnlyCookieForPublicSuffix|, and |sameSiteStrictOrLaxAllowed|.
4367
+
4368
+ <li><p> <a>Garbage collect cookies</a> given <var> request</var> 's
4369
+ <a for=request>current URL</a> 's <a for=url>host</a> .
4370
+ </ol>
4371
+ </ol>
4372
+ </div>
4373
+
4374
+ <h3 id=cookie-infrastructure>Cookie infrastructure</h3>
4375
+
4376
+ <p> These algorithms are not only for use with the `<code> Cookie</code> ` header, and are used in
4377
+ other specifications.
4378
+
4379
+ <div algorithm>
4380
+ <p> To <dfn>determine the same-site mode</dfn> for a given <a for=/>request</a> <var> request</var> :
4381
+
4382
+ <ol>
4383
+ <li><p> <a for=/>Assert</a> : <var> request</var> 's <a for=request>method</a> is "<code> GET</code> "
4384
+ or "<code> POST</code> ".
4385
+
4386
+ <li><p> If <var> request</var> 's <a for=request>top-level navigation initiator origin</a> is not
4387
+ null and is not <a for=/>same site</a> to <var> request</var> 's <a for=request>URL</a>' s
4388
+ <a for=url>origin</a> , then return "<code> UnsetOrLess</code> ".
4389
+
4390
+ <li><p> If <var> request</var> 's <a for=request>method</a> is "<code> GET</code> " and
4391
+ <var> request</var> 's <a for=request>destination</a> is "document", then return
4392
+ "<code> LaxOrLess</code> ".
4393
+
4394
+ <li><p> If <var> request</var> 's <a for=request>client</a>' s
4395
+ <a for=environment>has cross-site ancestor</a> is true then return "<code> UnsetOrLess</code> ".
4396
+
4397
+ <li><p> If <var> request</var> 's <a for=request>redirect-taint</a> is "<code> cross-site</code> ",
4398
+ then return "<code> UnsetOrLess</code> ".
4399
+
4400
+ <li><p> Return "<code> StrictOrLess</code> ".
4401
+ </ol>
4402
+ </div>
4403
+
4404
+
4405
+
4255
4406
<h2 id=fetching>Fetching</h2>
4256
4407
4257
4408
<p class=note> The algorithm below defines <a lt=fetch for=/>fetching</a> . In broad strokes, it takes
@@ -4729,8 +4880,8 @@ steps:
4729
4880
<!-- If you are ever tempted to move this around, carefully consider responses from about URLs,
4730
4881
blob URLs, service workers, HTTP cache, HTTP network, etc. -->
4731
4882
4732
- <li><p> If <var> request </var> has a <a for=request >redirect-tainted origin </a> , then set
4733
- <var> internalResponse </var> 's < a for=response>has-cross-origin-redirects </a> to true .
4883
+ <li><p> Set <var> internalResponse </var> 's <a for=response >redirect taint </a> to <var>request</var>' s
4884
+ <a for=request>redirect-taint </a> .
4734
4885
4735
4886
<li><p> If <var> request</var> 's <a for=request>timing allow failed flag</a> is unset, then set
4736
4887
<var> internalResponse</var> 's <a for=response>timing allow passed flag</a> .
@@ -4883,7 +5034,7 @@ steps:
4883
5034
<li>
4884
5035
<p> If <var> fetchParams</var> 's <a for="fetch params">request</a>' s <a for=request>mode</a> is
4885
5036
not "<code> navigate</code> " or <var> response</var> 's
4886
- <a for=response>has-cross-origin-redirects </a> is false :
5037
+ <a for=response>redirect taint </a> is " <code> same-origin </code> " :
4887
5038
4888
5039
<ol>
4889
5040
<li><p> Set <var> responseStatus</var> to <var> response</var> 's <a for=response>status</a> .
@@ -5766,21 +5917,7 @@ run these steps:
5766
5917
<p> If <var> includeCredentials</var> is true, then:
5767
5918
5768
5919
<ol>
5769
- <li>
5770
- <p> If the user agent is not configured to block cookies for <var> httpRequest</var> (see
5771
- <a href=https://httpwg.org/specs/rfc6265.html#privacy-considerations>section 7</a> of
5772
- [[!COOKIES]] ), then:
5773
-
5774
- <ol>
5775
- <li><p> Let <var> cookies</var> be the result of running the "cookie-string" algorithm (see
5776
- <a href=https://httpwg.org/specs/rfc6265.html#cookie>section 5.4</a> of
5777
- [[!COOKIES]] ) with the user agent's cookie store and <var> httpRequest</var> 's
5778
- <a for=request>current URL</a> .
5779
-
5780
- <li> If <var> cookies</var> is not the empty string, then <a for="header list">append</a>
5781
- (`<code> Cookie</code> `, <var> cookies</var> ) to <var> httpRequest</var> 's
5782
- <a for=request>header list</a> .
5783
- </ol>
5920
+ <li><p> <a>Append a request `<code>Cookie</code>` header</a> for <var> httpRequest</var> .
5784
5921
5785
5922
<li>
5786
5923
<p> If <var> httpRequest</var> 's <a for=request>header list</a>
@@ -6343,14 +6480,9 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
6343
6480
<li><p> Set <var> response</var> 's <a for=response>body</a> to a new <a for=/>body</a> whose
6344
6481
<a for=body>stream</a> is <var> stream</var> .
6345
6482
6346
- <li><p tracking-vector> If <var> includeCredentials</var> is true and the user agent is not
6347
- configured to block cookies for <var> request</var> (see
6348
- <a href=https://httpwg.org/specs/rfc6265.html#privacy-considerations>section 7</a> of
6349
- [[!COOKIES]] ), then run the "set-cookie-string" parsing algorithm (see
6350
- <a href=https://httpwg.org/specs/rfc6265.html#set-cookie>section 5.2</a> of [[!COOKIES]] ) on the
6351
- <a for=header>value</a> of each <a for=/>header</a> whose <a for=header>name</a> is a
6352
- <a>byte-case-insensitive</a> match for `<code> Set-Cookie</code> ` in <var> response</var> 's
6353
- <a for=response>header list</a> , if any, and <var> request</var> 's <a for=request>current URL</a> .
6483
+ <li><p tracking-vector> If <var> includeCredentials</var> is true, then the user agent should
6484
+ <a>parse and store response `<code>Set-Cookie</code>` headers</a> given <var> request</var> and
6485
+ <var> response</var> .
6354
6486
6355
6487
<li>
6356
6488
<p> Run these steps <a>in parallel</a> :
0 commit comments