Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: content/browser/child_process_security_policy_impl.h

Issue 2891443002: Keep subdomains of an isolated origin in the isolated origin's SiteInstance. (Closed)
Patch Set: More cleanup Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ 5 #ifndef CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_
6 #define CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ 6 #define CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 int policy); 186 int policy);
187 187
188 // Returns true if sending system exclusive messages is allowed. 188 // Returns true if sending system exclusive messages is allowed.
189 bool CanSendMidiSysExMessage(int child_id); 189 bool CanSendMidiSysExMessage(int child_id);
190 190
191 // Add an origin to the list of origins that require process isolation. 191 // Add an origin to the list of origins that require process isolation.
192 // When making process model decisions for such origins, the full 192 // When making process model decisions for such origins, the full
193 // scheme+host+port tuple rather than scheme and eTLD+1 will be used. 193 // scheme+host+port tuple rather than scheme and eTLD+1 will be used.
194 // SiteInstances for these origins will also use the full origin as site URL. 194 // SiteInstances for these origins will also use the full origin as site URL.
195 // 195 //
196 // Subdomains of an isolated origin are considered to be part of that
197 // origin's site. I.e., if https://isolated.foo.com is added as an isolated
Charlie Reis 2017/06/28 01:02:18 nit: s/I.e./For example/
alexmos 2017/06/28 18:29:51 Done.
198 // origin, then https://bar.isolated.foo.com will be considered part of the
199 // site for https://isolated.foo.com.
200 //
196 // Note that |origin| must not be unique. URLs that render with 201 // Note that |origin| must not be unique. URLs that render with
197 // unique origins, such as data: URLs, are not supported. Suborigins (see 202 // unique origins, such as data: URLs, are not supported. Suborigins (see
198 // https://w3c.github.io/webappsec-suborigins/ -- not to be confused with 203 // https://w3c.github.io/webappsec-suborigins/ -- not to be confused with
199 // subdomains) and non-standard schemes are also not supported. Sandboxed 204 // subdomains) and non-standard schemes are also not supported. Sandboxed
200 // frames (e.g., <iframe sandbox>) 205 // frames (e.g., <iframe sandbox>)
201 // *are* supported, since process placement decisions will be based on the 206 // *are* supported, since process placement decisions will be based on the
Charlie Reis 2017/06/28 01:02:18 minor nit: Rewrap?
alexmos 2017/06/28 18:29:51 Oops, done.
202 // URLs such frames navigate to, and not the origin of committed documents 207 // URLs such frames navigate to, and not the origin of committed documents
203 // (which might be unique). If an isolated origin opens an about:blank 208 // (which might be unique). If an isolated origin opens an about:blank
204 // popup, it will stay in the isolated origin's process. Nested URLs 209 // popup, it will stay in the isolated origin's process. Nested URLs
205 // (filesystem: and blob:) retain process isolation behavior of their inner 210 // (filesystem: and blob:) retain process isolation behavior of their inner
206 // origin. 211 // origin.
207 void AddIsolatedOrigin(const url::Origin& origin); 212 void AddIsolatedOrigin(const url::Origin& origin);
208 213
209 // Register a set of isolated origins as specified on the command line with 214 // Register a set of isolated origins as specified on the command line with
210 // the --isolate-origins flag. |origin_list| is the flag's value, which 215 // the --isolate-origins flag. |origin_list| is the flag's value, which
211 // contains the list of comma-separated scheme-host-port origins. See 216 // contains the list of comma-separated scheme-host-port origins. See
212 // AddIsolatedOrigin for definition of an isolated origin. 217 // AddIsolatedOrigin for definition of an isolated origin.
213 void AddIsolatedOriginsFromCommandLine(const std::string& origin_list); 218 void AddIsolatedOriginsFromCommandLine(const std::string& origin_list);
214 219
215 // Helper to check whether an origin requires origin-wide process isolation. 220 // Check whether |origin| requires origin-wide process isolation.
221 //
222 // Subdomains of an isolated origin are considered part of that isolated
223 // origin. Thus, if https://isolated.foo.com/ had been added as an isolated
224 // origin, this will return true for https://isolated.foo.com/,
225 // https://bar.isolated.foo.com/, or https://baz.bar.isolated.foo.com/; and
226 // it will return false for https://foo.com/ or https://unisolated.foo.com/.
Charlie Reis 2017/06/28 01:02:18 Maybe clarify that site URLs are not included here
alexmos 2017/06/28 18:29:51 Done. Yeah, ports would be included in the site U
Charlie Reis 2017/06/28 20:56:57 I mainly wanted to point out the difference for ot
216 bool IsIsolatedOrigin(const url::Origin& origin); 227 bool IsIsolatedOrigin(const url::Origin& origin);
217 228
229 // This function will check whether |origin| requires process isolation, and
230 // if so, it will return true and put the most specific matching isolated
231 // origin into |result|.
232 //
233 // If |origin| does not require process isolation, this function will return
234 // false, and |result| will be a unique origin. This means that neither
235 // |origin|, nor any origins for which |origin| is a subdomain, have been
236 // registered as isolated origins.
237 //
238 // For example, if both https://isolated.com/ and
239 // https://bar.foo.isolated.com/ are registered as isolated origins, then the
240 // values returned in |result| are:
241 // https://isolated.com/ --> https://isolated.com/
242 // https://foo.isolated.com/ --> https://isolated.com/
243 // https://bar.foo.isolated.com/ --> https://bar.foo.isolated.com/
244 // https://baz.bar.foo.isolated.com/ --> https://bar.foo.isolated.com/
Charlie Reis 2017/06/28 01:02:18 Maybe add a negative example? https://example.c
alexmos 2017/06/28 18:29:51 Good idea, done.
245 bool TryGetMostSpecificMatchForIsolatedOrigin(const url::Origin& origin,
Charlie Reis 2017/06/28 01:02:18 Maybe simplify the name to GetMatchingIsolatedOrig
alexmos 2017/06/28 18:29:51 Done.
246 url::Origin* result);
247
248 // Removes a previously added isolated origin.
Charlie Reis 2017/06/28 01:02:18 Might want to mention what considerations there ar
alexmos 2017/06/28 18:29:51 I've changed it to *ForTesting for now, and added
249 void RemoveIsolatedOrigin(const url::Origin& origin);
250
218 private: 251 private:
219 friend class ChildProcessSecurityPolicyInProcessBrowserTest; 252 friend class ChildProcessSecurityPolicyInProcessBrowserTest;
220 friend class ChildProcessSecurityPolicyTest; 253 friend class ChildProcessSecurityPolicyTest;
221 FRIEND_TEST_ALL_PREFIXES(ChildProcessSecurityPolicyInProcessBrowserTest, 254 FRIEND_TEST_ALL_PREFIXES(ChildProcessSecurityPolicyInProcessBrowserTest,
222 NoLeak); 255 NoLeak);
223 FRIEND_TEST_ALL_PREFIXES(ChildProcessSecurityPolicyTest, FilePermissions); 256 FRIEND_TEST_ALL_PREFIXES(ChildProcessSecurityPolicyTest, FilePermissions);
224 FRIEND_TEST_ALL_PREFIXES(ChildProcessSecurityPolicyTest, 257 FRIEND_TEST_ALL_PREFIXES(ChildProcessSecurityPolicyTest,
225 IsolateOriginsFromCommandLine); 258 IsolateOriginsFromCommandLine);
226 259
227 class SecurityState; 260 class SecurityState;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 // eTLD+1. Each of these origins requires a dedicated process. This set is 345 // eTLD+1. Each of these origins requires a dedicated process. This set is
313 // protected by |lock_|. 346 // protected by |lock_|.
314 std::set<url::Origin> isolated_origins_; 347 std::set<url::Origin> isolated_origins_;
315 348
316 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl); 349 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl);
317 }; 350 };
318 351
319 } // namespace content 352 } // namespace content
320 353
321 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ 354 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698