OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_COMMON_SANDBOX_MAC_H_ | 5 #ifndef CHROME_COMMON_SANDBOX_MAC_H_ |
6 #define CHROME_COMMON_SANDBOX_MAC_H_ | 6 #define CHROME_COMMON_SANDBOX_MAC_H_ |
7 | 7 |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 | 9 |
10 namespace sandbox { | 10 namespace sandbox { |
11 | 11 |
12 enum SandboxProcessType { | 12 enum SandboxProcessType { |
13 SANDBOX_TYPE_RENDERER, | 13 SANDBOX_TYPE_RENDERER, |
14 | 14 |
15 // Worker process has *everything* not needed for Cocoa locked down. | 15 // The worker processes uses the most restrictive sandbox which has almost |
| 16 // *everything* locked down. Only a couple of /System/Library/ paths and |
| 17 // some other very basic operations (e.g., reading metadata to allow |
| 18 // following symlinks) are permitted. |
16 SANDBOX_TYPE_WORKER, | 19 SANDBOX_TYPE_WORKER, |
17 | 20 |
18 // Utility process is as restrictive as the worker process except full access | 21 // Utility process is as restrictive as the worker process except full access |
19 // is allowed to one configurable directory. | 22 // is allowed to one configurable directory. |
20 SANDBOX_TYPE_UTILITY, | 23 SANDBOX_TYPE_UTILITY, |
| 24 |
| 25 // Native Client sandboxes. The plugin contains trusted code and the |
| 26 // loader contains the user's untrusted code. |
| 27 SANDBOX_TYPE_NACL_PLUGIN, |
| 28 SANDBOX_TYPE_NACL_LOADER, |
21 }; | 29 }; |
22 | 30 |
23 // Warm up System APIs that empirically need to be accessed before the Sandbox | 31 // Warm up System APIs that empirically need to be accessed before the Sandbox |
24 // is turned on. | 32 // is turned on. |
25 void SandboxWarmup(); | 33 void SandboxWarmup(); |
26 | 34 |
27 // Turns on the OS X sandbox for this process. | 35 // Turns on the OS X sandbox for this process. |
28 // |sandbox_type| - type of Sandbox to use. | 36 // |sandbox_type| - type of Sandbox to use. |
29 // |allowed_dir| - directory to allow access to, currently the only sandbox | 37 // |allowed_dir| - directory to allow access to, currently the only sandbox |
30 // profile that supports this is SANDBOX_TYPE_UTILITY . | 38 // profile that supports this is SANDBOX_TYPE_UTILITY . |
31 // | 39 // |
32 // |allowed_dir| must be a "simple" string since it's placed as is in a regex | 40 // |allowed_dir| must be a "simple" string since it's placed as is in a regex |
33 // i.e. it must not contain quotation characters, escaping or any characters | 41 // i.e. it must not contain quotation characters, escaping or any characters |
34 // that might have special meaning when blindly substituted into a regular | 42 // that might have special meaning when blindly substituted into a regular |
35 // expression - crbug.com/26492 . | 43 // expression - crbug.com/26492 . |
36 // Returns true on success, false if an error occurred enabling the sandbox. | 44 // Returns true on success, false if an error occurred enabling the sandbox. |
37 bool EnableSandbox(SandboxProcessType sandbox_type, | 45 bool EnableSandbox(SandboxProcessType sandbox_type, |
38 const FilePath& allowed_dir); | 46 const FilePath& allowed_dir); |
39 | 47 |
40 } // namespace sandbox | 48 } // namespace sandbox |
41 | 49 |
42 #endif // CHROME_COMMON_SANDBOX_MAC_H_ | 50 #endif // CHROME_COMMON_SANDBOX_MAC_H_ |
OLD | NEW |