@@ -41,6 +41,13 @@ spec: HTTP; urlPrefix: https://httpwg.org/specs/rfc7231.html#
4141 type: dfn; text: HTTP 3xx statuses; url: status.3xx
4242spec: tracking-dnt; urlPrefix: https://www.w3.org/TR/tracking-dnt/#
4343 type: dfn; text: tracking; url: dfn-tracking
44+ spec: RFC6265; urlPrefix: https://tools.ietf.org/html/rfc6265/
45+ type: dfn
46+ text: cookie store; url: section-5.3
47+ text: domain-match; url: section-5.1.3
48+ spec: RFC7234; urlPrefix: https://tools.ietf.org/html/rfc7234/
49+ type: dfn
50+ text: network cache; url: section-2
4451</pre>
4552
4653<section class="non-normative">
@@ -293,13 +300,34 @@ the PrivacyCG.
293300
294301* TODO: Define how bounce tracking information is stored; e.g. sites,
295302 timestamps, etc.
296- * TODO: Define a recurring global timer to run the analyze and delete algorithm.
297303
298304The user agent holds a <dfn>user activation map</dfn> which is a [=map=] of
299305[=site=] [=hosts=] to [=moments=] . The [=moments=] represent the most recent
300306[=wall clock=] time at which the user activated a top-level document on the
301307associated [=host=] .
302308
309+ The user agent holds a <dfn>candidate bounce tracking map</dfn> which is a
310+ [=map=] of [=site=] [=hosts=] to [=moments=] . The [=moments=] represent the
311+ most recent [=wall clock=] time at which a page on the given [=host=] performed
312+ an action that could indicate bounce tracking took place.
313+
314+ The <dfn>bounce tracking grace period</dfn> is an [=implementation-defined=]
315+ [=duration=] that represents the length of time after a possible bounce tracking
316+ event during which the user agent will wait for an interaction before deleting a
317+ [=host=] 's storage.
318+
319+ The <dfn>bounce tracking activation lifetime</dfn> is an
320+ [=implementation-defined=] [=duration=] that represents how long user
321+ activations will protect a [=host=] from storage deletion.
322+
323+ The <dfn>bounce tracking timer period</dfn> is an [=implementation-defined=]
324+ [=duration=] that represents how often to run the [=bounce tracking timer=]
325+ algorithm.
326+
327+ <p class=note>
328+ TODO: Provide reasonable example values for these constants.
329+ </p>
330+
303331<p class=note>
304332Schemeless site is used as the data structure key because by default cookies
305333are sent to both `http://` and `https://` pages on the same domain.
@@ -308,8 +336,6 @@ are sent to both `http://` and `https://` pages on the same domain.
308336<h3 id="bounce-tracking-mitigations-algorithms">Algorithms</h3>
309337
310338* TODO: Define the steps necessary to detect and store a "bounce".
311- * TODO: Define the steps to analyze information in the data model and delete
312- appropriate sites.
313339
314340<h4 id="bounce-tracking-mitigations-activation-monkey-patch">User Activation
315341Monkey Patch</h4>
@@ -338,6 +364,82 @@ model]]:
338364
3393651. Run [=record a user activation=] given <var ignore> document</var> .
340366
367+ <h4 id="bounce-tracking-mitigations-timer">Timer</h4>
368+
369+ <div algorithm>
370+
371+ To run the <dfn>bounce tracking timer</dfn> algorithm given a [=moment=] on the
372+ [=wall clock=] |now|,
373+ perform the following steps:
374+
375+ 1. [=map/For each=] |host| -> |bounceTime| of [=candidate bounce tracking map=] :
376+ 1. If |bounceTime| + [=bounce tracking grace period=] is less than or equal to
377+ |now|, then [=iteration/continue=] .
378+ 1. Let |activationTime| be [=user activation map=] [|host|] .
379+ 1. If |activationTime| is not null and |activationTime| +
380+ [=bounce tracking activation lifetime=] is greater than or equal to |now|,
381+ then [=iteration/continue=] .
382+ 1. If there is a [=top-level traversable=] whose
383+ [=navigable/active document=] 's [=Document/origin=]' s
384+ [=obtain a site|site=] 's [=host=] equals |host|,
385+ then [=iteration/continue=] .
386+ 1. [=Clear cookies for host=] given |host|.
387+ 1. [=Clear non-cookie storage for host=] given |host|.
388+ 1. [=Clear cache for host=] given |host|.
389+
390+ <p class=note> TODO: Do something to prevent repeated deletions, etc.</p>
391+
392+ </div>
393+
394+ Every [=bounce tracking timer period=] the user agent should run the
395+ [=bounce tracking timer=] algorithm given the [=wall clock=] 's
396+ [=wall clock/unsafe current time=] .
397+
398+ <h4 id="bounce-tracking-mitigations-deletion">Deletion</h4>
399+
400+ <p class=note> The cookie and cache clearing algorithms were largely copied from
401+ the <a href="https://w3c.github.io/webappsec-clear-site-data">Clear Site Data</a>
402+ spec. It would be nice to unify these in the future.</p>
403+
404+ <div algorithm>
405+
406+ To <dfn>clear cookies for host</dfn> given a [=host=] |host|, perform the
407+ following steps:
408+
409+ 1. Let |cookieList| be the set of cookies from the [=cookie store=] whose
410+ domain attribute is a [=domain-match=] with |host|.
411+ 1. [=list/For each=] |cookie| in |cookieList|:
412+ 1. Remove |cookie| from the [=cookie store=] .
413+
414+ </div>
415+
416+ <div algorithm>
417+ To <dfn>clear non-cookie storage for host</dfn> given a [=host=] |host|, perform
418+ the following steps:
419+
420+ 1. For each <a spec=storage>storage shed</a> |shed| held by the user agent or a
421+ [=traversable navigable=] :
422+ 1. [=map/For each=] |storageKey| -> |storageShelf| of |shed|:
423+ 1. If |storageKey|'s <a spec=storage for="storage key">origin</a> is an
424+ [=opaque origin=] , then [=iteration/continue=] .
425+ 1. If |storageKey|'s <a spec=storage for="storage key">origin</a>' s
426+ [=origin/host=] does not equal |host|, then [=iteration/continue=] .
427+ 1. Delete all data stored in |storageShelf|.
428+ 1. [=map/Remove=] |storageKey| from |shed|.
429+
430+ </div>
431+
432+ <div algorithm>
433+ To <dfn>clear cache for host</dfn> given a [=host=] |host|, perform the
434+ following steps:
435+
436+ 1. Let |cacheList| be the set of entries from the [=network cache=] whose
437+ target URI [=host=] equals |host|.
438+ 1. [=list/For each=] |entry| in |cacheList|:
439+ 1. Remove |entry| from the [=network cache=] .
440+
441+ </div>
442+
341443<h2 id="acknowledgements" class="no-num">Acknowledgements</h2>
342444
343445Many thanks to the Privacy Community Group for many good discussions about this proposal.
0 commit comments