Skip to content

Commit e7b6106

Browse files
committed
CLEAR: Neuter browsing contexts. Add privacy considerations.
1 parent de4f6ee commit e7b6106

File tree

2 files changed

+120
-18
lines changed

2 files changed

+120
-18
lines changed

specs/biblio.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@
146146
"title": "Protecting Users Against XSS-based Password Manager Abuse",
147147
"publisher": "AsiaCCS"
148148
},
149+
"STORAGE": {
150+
"authors": [ "Anne van Kesteren" ],
151+
"href": "https://storage.spec.whatwg.org/",
152+
"title": "Storage Living Standard",
153+
"status": "LS",
154+
"publisher": "WHATWG"
155+
},
149156
"UIREDRESS": {
150157
"authors": [
151158
"Giorgio Maone", "David Lin-Shung Huang", "Tobias Gondrom", "Brad Hill"

specs/clear-site-data/index.src.html

Lines changed: 113 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ <h1>Clear Site Data</h1>
4141
type: dfn
4242
urlPrefix: browsers.html
4343
text: ancestor browsing context
44+
text: active document
4445
text: browsing context
4546
text: creating a new document object; url: create-a-document-object
4647
text: nested browsing context
48+
text: active sandboxing flag set
49+
text: parse a sandboxing directive; url: sandboxing:parse-a-sandboxing-directive
4750
urlPrefix: webappapis.html
4851
text: environment settings object; url: settings-object
4952
text: incumbent settings object
@@ -197,7 +200,7 @@ <h3 id="goals">Goals</h3>
197200
7. All of the above can be propagated to the HTTP version of an HTTPS origin.
198201

199202
ISSUE: What do we do about today's multi-tab, multi-window user agents? Should
200-
we also neuter open execution contexts in the affected origins? Close open
203+
we also neuter open browsing contexts in the affected origins? Close open
201204
windows?
202205
</section>
203206

@@ -219,7 +222,7 @@ <h3 id="header">
219222
"Clear-Site-Data:" *<a>WSP</a> <a>data-type-list</a> *[ ";" *<a>WSP</a> <a>extension</a> *<a>WSP</a> ] *<a>WSP</a>
220223

221224
<dfn>data-type-list</dfn> = "*" / ( <a>exclusion</a> *( " " <a>exclusion</a> ) )
222-
<dfn>exclusion</dfn> = "<dfn>retainCookies</dfn>"
225+
<dfn>exclusion</dfn> = "<dfn>retainCookies</dfn>" / "<dfn>retainContexts</dfn>"
223226
<dfn>extension</dfn> = <a>subdomain-extension</a> / <a>unknown-extension</a>
224227
<dfn>subdomain-extension</dfn> = "<dfn>includeSubdomains</dfn>"
225228
<dfn>unknown-extension</dfn> = *( <a>WSP</a> / &lt;<a>VCHAR</a> except ";" and ","&gt; )
@@ -237,7 +240,11 @@ <h3 id="header">
237240
exclusions are as follows:
238241

239242
1. <code>retainCookies</code>, which implies that cookies for the site's
240-
host will <code>not</code> be removed.
243+
host will <strong>not</strong> be removed.
244+
245+
2. <code>retainContexts</code>, which implies that user agents which support
246+
opening multiple windows or tabs will <strong>not</strong> neuter existing
247+
<a>browsing contexts</a> open onto the site.
241248

242249
Invalid exclusion keywords present in a header's value are simply ignored.
243250
Parsing details can be found in [[#parsing]].
@@ -279,6 +286,17 @@ <h3 id="header">
279286
cached data for any host which is a subdomain of <var>response</var>'s
280287
{{Response/url}}'s {{URL/host}} MUST be removed.
281288

289+
5. If the value of the header's <a>data-type-list</a> does not contain
290+
<a><code>retainContexts</code></a>, then all <a>browsing contexts</a>
291+
whose <a>active Document</a>'s <a>origin</a> is identical to
292+
{{Response/url}}'s <a>origin</a> MUST be neutered by tightly sandboxing
293+
them.
294+
295+
If the <code>includeSubdomains</code> option is present, then all
296+
<a>browsing contexts</a> whose <a>active Document</a>'s <a>origin</a>'s
297+
{{URL/host}} is a subdomain of <var>response</var>'s {{Response/url}}'s
298+
{{URL/host}} MUST be neutered.
299+
282300
<h3 id="fetch-integration">Fetch Integration</h3>
283301

284302
ISSUE: Monkey patching! Talk with Anne.
@@ -321,7 +339,7 @@ <h4 id="should-include-subdomains">
321339

322340
<h4 id="matches-origin">
323341
Does <var>origin</var> match <var>origin to clear</var> and
324-
<var>subdomains</var>
342+
<var>subdomain state</var>
325343
</h4>
326344

327345
TODO: Given an origin, the origin to clear, and the "include subdomains"
@@ -339,18 +357,51 @@ <h3 id="clear">
339357
1. Let <var>exclusions</var> be the result of [[#get-exclusions]] executed on
340358
<var>response</var>.
341359

342-
2. Let <var>subdomains</var> be the result of [[#should-include-subdomains]]
343-
executed on <var>response</var>.
360+
2. Let <var>subdomain state</var> be the result of
361+
[[#should-include-subdomains]] executed on <var>response</var>.
362+
363+
4. If <var>exclusions</var> does not contain "<code>contexts</code>", execute
364+
[[#neuter-contexts]] on <var>response</var>'s {{Response/url}}'s
365+
<a>origin</a>, with <var>subdomain state</var>.
344366

345-
3. If <var>exclusions</var> does not contain "<code>cookies</code>", execute
367+
5. If <var>exclusions</var> does not contain "<code>cookies</code>", execute
346368
[[#clear-cookies]] on <var>response</var>'s {{Response/url}}'s
347-
<a>origin</a>, with <var>subdomains</var>.
369+
<a>origin</a>, with <var>subdomain state</var>.
348370

349-
4. Execute [[#clear-dom]] on <var>response</var>'s {{Response/url}}'s
350-
<a>origin</a>, with <var>subdomains</var>.
371+
6. Execute [[#clear-dom]] on <var>response</var>'s {{Response/url}}'s
372+
<a>origin</a>, with <var>subdomain state</var>.
351373

352-
5. Execute [[#clear-cache]] on <var>response</var>'s {{Response/url}}'s
353-
<a>origin</a>, with <var>subdomains</var>.
374+
7. Execute [[#clear-cache]] on <var>response</var>'s {{Response/url}}'s
375+
<a>origin</a>, with <var>subdomain state</var>.
376+
377+
<h4 id="neuter-contexts">
378+
Neuter browsing contexts matching <var>origin</var> with
379+
<var>subdomain state</var>
380+
</h4>
381+
382+
Given an <a>origin</a> (<var>origin</var>) and a <var>subdomain state</var>
383+
of either <a><code>Include Subdomains</code></a> or <a><code>Exclude
384+
Subdomains</code></a>, this algorithm walks through the set of <a>browsing
385+
contexts</a> which the user agent knows about, and sandboxes each in order
386+
to prevent them from recreating wiped data (from in-memory JavaScript
387+
variables, for instance):
388+
389+
1. For each <var>context</var> in the user agent's set of <a>browsing
390+
contexts</a>:
391+
392+
1. Let <var>document</var> be <var>context</var>'s <a>active
393+
document</a>.
394+
395+
2. If [[#matches-origin]] returns <a><code>Matches</code></a> when
396+
executed on <var>context</var>'s <a>origin</a>, <var>origin</var>, and
397+
<code>subdomain state</code>:
398+
399+
1. <a>Parse a sandboxing directive</a> using the empty string as
400+
the <var>input</var>, and <var>document</var>'s <a>active
401+
sandboxing flag set</a> as the <var>output</var>.
402+
403+
ISSUE: This won't be an atomic set of operations. How can we prevent collusion
404+
between browsing contexts to potentially bypass neutering?
354405

355406
<h4 id="clear-cache">
356407
Clear cache for <var>origin</var> with <var>subdomain state</var>
@@ -388,7 +439,8 @@ <h4 id="clear-cache">
388439
hand-wavey with the vendor-specific section can we be? For instance,
389440
Chrome clears out prerendered pages, script caches, WebGL shader caches,
390441
WebRTC bits and pieces, address bar suggestion caches, various networking
391-
bits that aren't representations (HSTS/HPKP, SCDH, etc.).
442+
bits that aren't representations (HSTS/HPKP, SCDH, etc.). Perhaps
443+
[[STORAGE]] will make this clearer?
392444

393445
<h4 id="clear-cookies">
394446
Clear cookies for <var>origin</var> with <var>subdomain state</var>
@@ -429,15 +481,15 @@ <h4 id="clear-cookies">
429481

430482
<h4 id="clear-dom">
431483
Clear DOM-accessible storage for <var>origin</var> with
432-
<var>subdomains</var>
484+
<var>subdomain state</var>
433485
</h4>
434486

435487
1. For each <var>area</var> in the user agent's set of <a>local storage
436488
areas</a> [[!HTML]]:
437489

438490
1. If [[#matches-origin]] returns <a><code>Matches</code></a> when
439491
executed on <var>area</var>'s <a>origin</a>, <var>origin</var>, and
440-
<code>subdomains</code>:
492+
<code>subdomain state</code>:
441493

442494
1. Execute {{Storage/clear()}} on the {{Storage}} object associated
443495
with <var>area</var>.
@@ -447,7 +499,7 @@ <h4 id="clear-dom">
447499

448500
1. If [[#matches-origin]] returns <a><code>Matches</code></a> when
449501
executed on <var>area</var>'s <a>origin</a>, <var>origin</var>, and
450-
<code>subdomains</code>:
502+
<code>subdomain state</code>:
451503

452504
1. Execute {{Storage/clear()}} on the {{Storage}} object associated
453505
with <var>area</var>.
@@ -457,7 +509,7 @@ <h4 id="clear-dom">
457509

458510
1. If [[#matches-origin]] returns <a><code>Matches</code></a> when
459511
executed on <var>database</var>'s <a>origin</a>, <var>origin</var>,
460-
and <code>subdomains</code>:
512+
and <code>subdomain state</code>:
461513

462514
1. Set <var>database</var>'s <a>delete pending</a> flag to
463515
<code>true</code>.
@@ -477,7 +529,7 @@ <h4 id="clear-dom">
477529

478530
1. If [[#matches-origin]] returns <a><code>Matches</code></a> when
479531
executed on <var>database</var>'s <a>origin</a>, <var>origin</var>,
480-
and <code>subdomains</code>:
532+
and <code>subdomain state</code>:
481533

482534
1. Delete <var>database</var>.
483535

@@ -486,6 +538,49 @@ <h4 id="clear-dom">
486538

487539

488540
ISSUE: Define how we clear Filesystems, Dedicated Workers, Shared Workers, Service Workers, etc.
541+
542+
ISSUE: How do we say something about plugins here? Point out to
543+
<a href="https://wiki.mozilla.org/NPAPI:ClearSiteData">NPP_ClearSiteData</a>?
544+
</section>
545+
546+
<section>
547+
<h2 id="privacy">Privacy Considerations</h2>
548+
549+
<h3 id="user-vs-author">Web developers control the timing.</h3>
550+
551+
If triggered at appropriate times, <a><code>Clear-Site-Data</code></a> can
552+
increase a user's privacy and security by clearing sensitive data from their
553+
user agent. However, note that the web developer (and <em>not</em> the user)
554+
is in control of when the clearing event is triggered. Even assuming a
555+
non-malicious site author, users can't rely on data being cleared at any
556+
particular point, nor are users in control of what data types are cleared.
557+
558+
If a user wishes to ensure that site data is indeed cleared at some specific
559+
point, they ought to rely on the data-clearing functionality offered by their
560+
user agent.
561+
562+
At a bare minimum, user agents OUGHT TO (in the [[RFC6919]] sense of the
563+
words) offer the same functionality to users that they offer to web
564+
developers. Ideally, they will offer significantly more than we can offer at
565+
a platform level (clearing browsing history, for example).
566+
567+
<h3 id="remnants">Remnants of data on disk.</h3>
568+
569+
While <a><code>Clear-Site-Data</code></a> triggers a clearing event in a
570+
user's agent, it is difficult to make promises about the state of a user's
571+
disk after a clearing event takes place. In particular, note that it is up
572+
to the user agent to ensure that all traces of a site's date is actually
573+
removed from disk, which can be a herculean task (consider virtual memory,
574+
as a good example of a larger issue).
575+
576+
In short, most user agents implement data clearing as "best effort", but
577+
can't promise an exhaustive wipe.
578+
579+
If a user wishes to ensure that site data does not remain on disk, the best
580+
way to do so is to use a browsing mode that promises not to intentionally
581+
write data to disk (Chrome's "Incognito", Internet Explorer's "InPrivate",
582+
etc). These modes will do a better job of keeping data off disk, but are
583+
still subject to a number of limitations at the edges.
489584
</section>
490585

491586
<section>

0 commit comments

Comments
 (0)