@@ -57,47 +57,137 @@ urlPrefix: https://w3c.github.io/webappsec-csp/; spec:CSP3
57
57
58
58
# Introduction # {#introduction}
59
59
60
- Many powerful capabilities cannot safely be enabled in the Web Platform as it
61
- is defined today. Some may break the platform's fundamental security
62
- primitives, others may be too complex or technical to expect users to make
63
- informed decisions about. Exposing these capabilities requires establishing
64
- more trust in a page's content than the web can currently provide.
65
- [Isolated Web Apps] (https://github.com/WICG/isolated-web-apps) define one method
66
- of establishing this trust by requiring third-party attestation before
67
- enabling particularly powerful capabilities.
60
+ Throughout its existence the web has been evolved into an increasingly capable
61
+ application platform. Secure Contexts formalize transport security, Cross
62
+ Origin Isolation mitigates side-channel attacks, and device-specific permission
63
+ prompts make device access more scoped and understandable to users. Each of
64
+ these advancements either improved the safety guarantees of the web platform,
65
+ or guided users towards a more accurate expection of a page's behavior, and
66
+ unlocked new classes of capabilities that could be brought safely to the web.
67
+
68
+ Despite these advancements, there are some APIs that still cannot safely be
69
+ exposed to the web because they violate the web's security primitives in a way
70
+ that cannot reasonably be addressed, or cannot be explained clearly enough for
71
+ users to make an informed decision about whether or not to grant a site access
72
+ to them. If the platform cannot prove that exposing an API to a particular site
73
+ is safe, then trust must derive from external attestations.
74
+
75
+ Any assertion about the safety or behavior of a page requires knowing the
76
+ contents and behavior of the page; attestations are only meaningful if the code
77
+ that was vouched for is the same code being executed. Because of this, any
78
+ system that delegates trust decisions must be able to verify the integrity of
79
+ the code it is running — it must know that it matches the code that was
80
+ delegated trust.
81
+
82
+ Additionally, capabilities that don't fit within the web's current security
83
+ model have the potential to pose a risk to other web content. This risk is
84
+ bidirectional: sandbox-piercing capabilities could be used to attack other
85
+ sites, and having access to powerful capabilities makes a site a more
86
+ attractive target for bad actors. To mitigate these risks, any content that is
87
+ granted access to a capability through the mechanisms described in this
88
+ specification must be isolated from a user's normal browsing session.
89
+
90
+ This specification defines <dfn>Isolated Contexts</dfn> , which are environments
91
+ that meet a minimum standard of integrity and isolation, and provide a means of
92
+ auditing web content for the purpose of trustworthiness attestation, and
93
+ isolate this content from the rest of the user's browsing data.
94
+
95
+ While this specification focuses on user-agent provided capabilities, Isolated
96
+ Contexts could be beneficial for any web page functionality whose threat model
97
+ isn't satisfied by the web's security model. For example, the threat model of
98
+ some end-to-end encrypted chat applications includes server compromise, which
99
+ is not protected against by the web today. The auditability and attestation
100
+ enabled by Isolated Contexts could allow these applications to have confidence
101
+ in the integrity and providence of the code they are running.
102
+
103
+
104
+ # Isolated Contexts # {#isolated-context-info}
105
+
106
+ [=Isolated Contexts=] are defined through a series of [[#monkey]] to existing
107
+ specifications.
108
+
109
+ Integrity is verified through a combination of strict [[CSP]] , which ensures
110
+ cross-origin executable content cannot be loaded, and an integrity verification
111
+ algorithm, which is an abstracts mechanism to validate content loaded within a
112
+ page. This specification does not mandate a specific validation approach, it
113
+ only defines how one would be used to determine if an environment is an
114
+ Isolated Context.
115
+
116
+
117
+
118
+ ## Which APIs should require an Isolated Context? ## {#which-apis}
119
+
120
+ As few as possible. Any API that can only be exposed to Isolated Contexts very
121
+ likely violates at least one
122
+ <a href="https://w3ctag.github.io/design-principles/#basic-principles">
123
+ design principle</a> of the web, most commonly that
124
+ <a href="https://w3ctag.github.io/design-principles/#safe-to-browse">
125
+ it should be safe to visit a web page</a> . Before gating an API on
126
+ IsolatedContext, consider the following questions:
127
+
128
+ 1. Is a new Web Platform API the only way to address the problems this API is
129
+ trying to solve? Web Extensions and native applications have their place.
130
+ 1. If a capability cannot be communicated clearly to users, is there another
131
+ way to solve the problem that would be more understandable to users, and
132
+ allow them to make informed decisions about what content can access it?
133
+ 1. Can the scope of the API be reduced such that it no longer poses an
134
+ unacceptable risk if exposed to an average web page?
135
+
136
+ If no alternative can be found, requiring an API to run within an Isolated
137
+ Context can be considered as a last resort.
138
+
139
+ Part of what makes the web such a unique and successful platform is its lack of
140
+ gatekeepers. Anyone can purchase a domain name and host their content without
141
+ approvals, and with full access to the Web Platform's API surface; everyone has
142
+ equal footing. The security guarantees provided by Isolated Contexts enable
143
+ auditability, which in turn enables attestation. This attestation, usually
144
+ third-party, is the main reason a browser vendor would restrict an API to
145
+ Isolated Contexts. Third-party attestation introduces gatekeepers to the Web
146
+ Platform, which is not a desirable direction for the platform to move. Browser
147
+ vendors must be extremely selective about which APIs they allow in Isolated
148
+ Contexts; changing an API so it can be used in a Secure Context should be
149
+ strongly preferred whenever possible.
150
+
151
+
152
+ ## UI Treatment ## {#ui-treatment}
153
+
154
+ This specification focuses on the technical requirements needed to achieve
155
+ integrity and isolation, but if Isolated Contexts are being used to enable
156
+ powerful capabilities, it is also critical to not violate user expectations.
157
+
158
+ Users trust the web because they've been taught that web pages are safe, have
159
+ limited access to their device, and that they are in control of this access. All
160
+ APIs on the Web Platform have been carefully designed towards this end, with a
161
+ goal of ensuring that
162
+ <a href="https://w3ctag.github.io/design-principles/#safe-to-browse">
163
+ it should be safe to visit a web page</a> .
164
+
165
+ Browser vendors should consider whether capabilities restricted to Isolated
166
+ Contexts would violate a user's expectation of what a web page is capable of
167
+ doing. Violating these expectations would not only damage trust in the site, but
168
+ has the risk of damaging a user's trust in the Web Platform as a whole.
169
+
170
+ To mitigate this, steps should be taken by the user agent to convey to users
171
+ that content running within an Isolated Context is not typical web content. This
172
+ could involve an installation flow, or a Web App UI treatment.
68
173
69
- Deciding whether a page is trusted enough to access powerful capabilities
70
- requires knowing the contents and behavior of the page; attestations of trust
71
- are only meaningful if the code being vouched for is the same code being
72
- executed. Because of this, any system seeking to delegate trust decisions within
73
- a page must provide a method of validating the integrity of the page and the
74
- executable content within it.
75
174
76
- Additionally, content utilizing powerful capabilities must be isolated from
77
- a user's default browsing session. This is to both protect traditional web
78
- sites from potentially sandbox-piercing capabilities, and to protect the
79
- page using powerful capabilities from attack from traditional web pages.
80
-
81
- This specification defines a method of establishing these properties, integrity
82
- and isolation, in web content.
83
-
84
-
85
- # Isolated Contexts # {#isolated-contexts}
175
+ # Monkey Patches # {#monkey}
86
176
87
- [=Isolated contexts=] define a minimum standard of isolation and integrity for
88
- executable content within a web page. They are defined through a series of
89
- monkey patches to existing specifications:
177
+ This specification makes the following monkey patches to existing
178
+ specifications:
90
179
91
180
* [[CSP]] will define the characteristics of a policy that's robust enough to
92
- meaningfully defend against attack. It builds on what we've learned from
93
- explorations like [[strict-csp]] and [[securer-contexts]] , pushing
94
- developers towards well-understood and valuable defenses.
181
+ meaningfully defend against attack, and enforce that cross-origin content
182
+ cannot be loaded. It builds on what we've learned from explorations like
183
+ [[strict-csp]] and [[securer-contexts]] , pushing developers towards
184
+ well-understood and valuable defenses.
95
185
96
186
* [[HTML]] will define the ways in which those CSP characteristics, along
97
187
with other security requirements, are evaluated within a given context,
98
188
similar conceptually to [=secure context=] and [=environment settings
99
189
object/cross-origin isolated capability=] . It will additionally define
100
- [=browsing context group =] properties needed to verify the integrity of
190
+ [=user agent =] properties needed to verify the integrity of
101
191
an [=origin=] 's resources.
102
192
103
193
* [[FETCH]] will add integrity verification to the [=fetch=] algorithm.
@@ -109,7 +199,6 @@ monkey patches to existing specifications:
109
199
* [[STORAGE]] will define the double-keying requirements of
110
200
[=Isolated Contexts=] .
111
201
112
- # Monkey Patches # {#monkey}
113
202
114
203
## Content Security Policy ## {#monkey-csp}
115
204
@@ -590,6 +679,7 @@ after similarly handling [{{CrossOriginIsolated}}] (step 4 below).
590
679
</ol>
591
680
</div>
592
681
682
+
593
683
## Storage ## {#monkey-storage}
594
684
595
685
The [=obtain a storage key for non-storage purposes=] algorithm is extended to
0 commit comments