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

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

Issue 2364633004: Lock down the registration of blob:chrome-extension:// URLs (Closed)
Patch Set: Pare down CL Created 4 years, 2 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 25 matching lines...) Expand all
36 : NON_EXPORTED_BASE(public ChildProcessSecurityPolicy) { 36 : NON_EXPORTED_BASE(public ChildProcessSecurityPolicy) {
37 public: 37 public:
38 // Object can only be created through GetInstance() so the constructor is 38 // Object can only be created through GetInstance() so the constructor is
39 // private. 39 // private.
40 ~ChildProcessSecurityPolicyImpl() override; 40 ~ChildProcessSecurityPolicyImpl() override;
41 41
42 static ChildProcessSecurityPolicyImpl* GetInstance(); 42 static ChildProcessSecurityPolicyImpl* GetInstance();
43 43
44 // ChildProcessSecurityPolicy implementation. 44 // ChildProcessSecurityPolicy implementation.
45 void RegisterWebSafeScheme(const std::string& scheme) override; 45 void RegisterWebSafeScheme(const std::string& scheme) override;
46 void RegisterWebSafeIsolatedScheme(const std::string& scheme) override;
46 bool IsWebSafeScheme(const std::string& scheme) override; 47 bool IsWebSafeScheme(const std::string& scheme) override;
47 void GrantReadFile(int child_id, const base::FilePath& file) override; 48 void GrantReadFile(int child_id, const base::FilePath& file) override;
48 void GrantCreateReadWriteFile(int child_id, 49 void GrantCreateReadWriteFile(int child_id,
49 const base::FilePath& file) override; 50 const base::FilePath& file) override;
50 void GrantCopyInto(int child_id, const base::FilePath& dir) override; 51 void GrantCopyInto(int child_id, const base::FilePath& dir) override;
51 void GrantDeleteFrom(int child_id, const base::FilePath& dir) override; 52 void GrantDeleteFrom(int child_id, const base::FilePath& dir) override;
52 void GrantReadFileSystem(int child_id, 53 void GrantReadFileSystem(int child_id,
53 const std::string& filesystem_id) override; 54 const std::string& filesystem_id) override;
54 void GrantWriteFileSystem(int child_id, 55 void GrantWriteFileSystem(int child_id,
55 const std::string& filesystem_id) override; 56 const std::string& filesystem_id) override;
56 void GrantCreateFileForFileSystem(int child_id, 57 void GrantCreateFileForFileSystem(int child_id,
57 const std::string& filesystem_id) override; 58 const std::string& filesystem_id) override;
58 void GrantCreateReadWriteFileSystem( 59 void GrantCreateReadWriteFileSystem(
59 int child_id, 60 int child_id,
60 const std::string& filesystem_id) override; 61 const std::string& filesystem_id) override;
61 void GrantCopyIntoFileSystem(int child_id, 62 void GrantCopyIntoFileSystem(int child_id,
62 const std::string& filesystem_id) override; 63 const std::string& filesystem_id) override;
63 void GrantDeleteFromFileSystem(int child_id, 64 void GrantDeleteFromFileSystem(int child_id,
64 const std::string& filesystem_id) override; 65 const std::string& filesystem_id) override;
65 void GrantOrigin(int child_id, const url::Origin& origin) override; 66 void GrantOrigin(int child_id, const url::Origin& origin) override;
66 void GrantScheme(int child_id, const std::string& scheme) override; 67 void GrantScheme(int child_id, const std::string& scheme) override;
68 bool CanRequestURL(int child_id, const GURL& url) override;
69 bool CanCommitURL(int child_id, const GURL& url) override;
67 bool CanReadFile(int child_id, const base::FilePath& file) override; 70 bool CanReadFile(int child_id, const base::FilePath& file) override;
68 bool CanCreateReadWriteFile(int child_id, 71 bool CanCreateReadWriteFile(int child_id,
69 const base::FilePath& file) override; 72 const base::FilePath& file) override;
70 bool CanReadFileSystem(int child_id, 73 bool CanReadFileSystem(int child_id,
71 const std::string& filesystem_id) override; 74 const std::string& filesystem_id) override;
72 bool CanReadWriteFileSystem(int child_id, 75 bool CanReadWriteFileSystem(int child_id,
73 const std::string& filesystem_id) override; 76 const std::string& filesystem_id) override;
74 bool CanCopyIntoFileSystem(int child_id, 77 bool CanCopyIntoFileSystem(int child_id,
75 const std::string& filesystem_id) override; 78 const std::string& filesystem_id) override;
76 bool CanDeleteFromFileSystem(int child_id, 79 bool CanDeleteFromFileSystem(int child_id,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 123
121 // Grant the child process the ability to use Web UI Bindings. 124 // Grant the child process the ability to use Web UI Bindings.
122 void GrantWebUIBindings(int child_id); 125 void GrantWebUIBindings(int child_id);
123 126
124 // Grant the child process the ability to read raw cookies. 127 // Grant the child process the ability to read raw cookies.
125 void GrantReadRawCookies(int child_id); 128 void GrantReadRawCookies(int child_id);
126 129
127 // Revoke read raw cookies permission. 130 // Revoke read raw cookies permission.
128 void RevokeReadRawCookies(int child_id); 131 void RevokeReadRawCookies(int child_id);
129 132
130 // Before servicing a child process's request for a URL, the browser should
131 // call this method to determine whether the process has the capability to
132 // request the URL.
133 bool CanRequestURL(int child_id, const GURL& url);
134
135 // Whether the process is allowed to commit a document from the given URL.
136 // This is more restrictive than CanRequestURL, since CanRequestURL allows
137 // requests that might lead to cross-process navigations or external protocol
138 // handlers.
139 bool CanCommitURL(int child_id, const GURL& url);
140 133
141 // Whether the given origin is valid for an origin header. Valid origin 134 // Whether the given origin is valid for an origin header. Valid origin
142 // headers are commitable URLs plus suborigin URLs. 135 // headers are commitable URLs plus suborigin URLs.
143 bool CanSetAsOriginHeader(int child_id, const GURL& url); 136 bool CanSetAsOriginHeader(int child_id, const GURL& url);
144 137
145 // Explicit permissions checks for FileSystemURL specified files. 138 // Explicit permissions checks for FileSystemURL specified files.
146 bool CanReadFileSystemFile(int child_id, const storage::FileSystemURL& url); 139 bool CanReadFileSystemFile(int child_id, const storage::FileSystemURL& url);
147 bool CanWriteFileSystemFile(int child_id, const storage::FileSystemURL& url); 140 bool CanWriteFileSystemFile(int child_id, const storage::FileSystemURL& url);
148 bool CanCreateFileSystemFile(int child_id, const storage::FileSystemURL& url); 141 bool CanCreateFileSystemFile(int child_id, const storage::FileSystemURL& url);
149 bool CanCreateReadWriteFileSystemFile(int child_id, 142 bool CanCreateReadWriteFileSystemFile(int child_id,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 int child_id, 223 int child_id,
231 const std::string& filesystem_id, 224 const std::string& filesystem_id,
232 int permission); 225 int permission);
233 226
234 // You must acquire this lock before reading or writing any members of this 227 // You must acquire this lock before reading or writing any members of this
235 // class. You must not block while holding this lock. 228 // class. You must not block while holding this lock.
236 base::Lock lock_; 229 base::Lock lock_;
237 230
238 // These schemes are white-listed for all child processes. This set is 231 // These schemes are white-listed for all child processes. This set is
239 // protected by |lock_|. 232 // protected by |lock_|.
240 SchemeSet web_safe_schemes_; 233 SchemeSet schemes_okay_to_commit_in_any_process_;
234 SchemeSet schemes_okay_to_request_in_any_process_;
241 235
242 // These schemes do not actually represent retrievable URLs. For example, 236 // These schemes do not actually represent retrievable URLs. For example,
243 // the the URLs in the "about" scheme are aliases to other URLs. This set is 237 // the the URLs in the "about" scheme are aliases to other URLs. This set is
244 // protected by |lock_|. 238 // protected by |lock_|.
245 SchemeSet pseudo_schemes_; 239 SchemeSet pseudo_schemes_;
246 240
247 // This map holds a SecurityState for each child process. The key for the 241 // This map holds a SecurityState for each child process. The key for the
248 // map is the ID of the ChildProcessHost. The SecurityState objects are 242 // map is the ID of the ChildProcessHost. The SecurityState objects are
249 // owned by this object and are protected by |lock_|. References to them must 243 // owned by this object and are protected by |lock_|. References to them must
250 // not escape this class. 244 // not escape this class.
251 SecurityStateMap security_state_; 245 SecurityStateMap security_state_;
252 246
253 // This maps keeps the record of which js worker thread child process 247 // This maps keeps the record of which js worker thread child process
254 // corresponds to which main js thread child process. 248 // corresponds to which main js thread child process.
255 WorkerToMainProcessMap worker_map_; 249 WorkerToMainProcessMap worker_map_;
256 250
257 FileSystemPermissionPolicyMap file_system_policy_map_; 251 FileSystemPermissionPolicyMap file_system_policy_map_;
258 252
259 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl); 253 DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl);
260 }; 254 };
261 255
262 } // namespace content 256 } // namespace content
263 257
264 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_ 258 #endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698