OLD | NEW |
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 SANDBOX_WIN_SRC_SANDBOX_POLICY_H_ | 5 #ifndef SANDBOX_WIN_SRC_SANDBOX_POLICY_H_ |
6 #define SANDBOX_WIN_SRC_SANDBOX_POLICY_H_ | 6 #define SANDBOX_WIN_SRC_SANDBOX_POLICY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "sandbox/win/src/sandbox_types.h" | 12 #include "sandbox/win/src/sandbox_types.h" |
13 #include "sandbox/win/src/security_level.h" | 13 #include "sandbox/win/src/security_level.h" |
14 | 14 |
15 namespace sandbox { | 15 namespace sandbox { |
16 | 16 |
17 class TargetPolicy { | 17 class TargetPolicy { |
18 public: | 18 public: |
19 // Windows subsystems that can have specific rules. | 19 // Windows subsystems that can have specific rules. |
20 // Note: The process subsystem(SUBSY_PROCESS) does not evaluate the request | 20 // Note: The process subsystem(SUBSY_PROCESS) does not evaluate the request |
21 // exactly like the CreateProcess API does. See the comment at the top of | 21 // exactly like the CreateProcess API does. See the comment at the top of |
22 // process_thread_dispatcher.cc for more details. | 22 // process_thread_dispatcher.cc for more details. |
23 enum SubSystem { | 23 enum SubSystem { |
24 SUBSYS_FILES, // Creation and opening of files and pipes. | 24 SUBSYS_FILES, // Creation and opening of files and pipes. |
25 SUBSYS_NAMED_PIPES, // Creation of named pipes. | 25 SUBSYS_NAMED_PIPES, // Creation of named pipes. |
26 SUBSYS_PROCESS, // Creation of child processes. | 26 SUBSYS_PROCESS, // Creation of child processes. |
27 SUBSYS_REGISTRY, // Creation and opening of registry keys. | 27 SUBSYS_REGISTRY, // Creation and opening of registry keys. |
28 SUBSYS_SYNC, // Creation of named sync objects. | 28 SUBSYS_SYNC, // Creation of named sync objects. |
29 SUBSYS_HANDLES // Duplication of handles to other processes. | 29 SUBSYS_HANDLES, // Duplication of handles to other processes. |
| 30 SUBSYS_WIN32K_LOCKDOWN // Win32K Lockdown related policy. |
30 }; | 31 }; |
31 | 32 |
32 // Allowable semantics when a rule is matched. | 33 // Allowable semantics when a rule is matched. |
33 enum Semantics { | 34 enum Semantics { |
34 FILES_ALLOW_ANY, // Allows open or create for any kind of access that | 35 FILES_ALLOW_ANY, // Allows open or create for any kind of access that |
35 // the file system supports. | 36 // the file system supports. |
36 FILES_ALLOW_READONLY, // Allows open or create with read access only. | 37 FILES_ALLOW_READONLY, // Allows open or create with read access only. |
37 FILES_ALLOW_QUERY, // Allows access to query the attributes of a file. | 38 FILES_ALLOW_QUERY, // Allows access to query the attributes of a file. |
38 FILES_ALLOW_DIR_ANY, // Allows open or create with directory semantics | 39 FILES_ALLOW_DIR_ANY, // Allows open or create with directory semantics |
39 // only. | 40 // only. |
40 HANDLES_DUP_ANY, // Allows duplicating handles opened with any | 41 HANDLES_DUP_ANY, // Allows duplicating handles opened with any |
41 // access permissions. | 42 // access permissions. |
42 HANDLES_DUP_BROKER, // Allows duplicating handles to the broker process. | 43 HANDLES_DUP_BROKER, // Allows duplicating handles to the broker process. |
43 NAMEDPIPES_ALLOW_ANY, // Allows creation of a named pipe. | 44 NAMEDPIPES_ALLOW_ANY, // Allows creation of a named pipe. |
44 PROCESS_MIN_EXEC, // Allows to create a process with minimal rights | 45 PROCESS_MIN_EXEC, // Allows to create a process with minimal rights |
45 // over the resulting process and thread handles. | 46 // over the resulting process and thread handles. |
46 // No other parameters besides the command line are | 47 // No other parameters besides the command line are |
47 // passed to the child process. | 48 // passed to the child process. |
48 PROCESS_ALL_EXEC, // Allows the creation of a process and return fill | 49 PROCESS_ALL_EXEC, // Allows the creation of a process and return fill |
49 // access on the returned handles. | 50 // access on the returned handles. |
50 // This flag can be used only when the main token of | 51 // This flag can be used only when the main token of |
51 // the sandboxed application is at least INTERACTIVE. | 52 // the sandboxed application is at least INTERACTIVE. |
52 EVENTS_ALLOW_ANY, // Allows the creation of an event with full access. | 53 EVENTS_ALLOW_ANY, // Allows the creation of an event with full access. |
53 EVENTS_ALLOW_READONLY, // Allows opening an even with synchronize access. | 54 EVENTS_ALLOW_READONLY, // Allows opening an even with synchronize access. |
54 REG_ALLOW_READONLY, // Allows readonly access to a registry key. | 55 REG_ALLOW_READONLY, // Allows readonly access to a registry key. |
55 REG_ALLOW_ANY // Allows read and write access to a registry key. | 56 REG_ALLOW_ANY, // Allows read and write access to a registry key. |
| 57 FAKE_USER_GDI_INIT // Fakes user32 and gdi32 initialization. This can |
| 58 // be used to allow the DLLs to load and initialize |
| 59 // even if the process cannot access that subsystem. |
56 }; | 60 }; |
57 | 61 |
58 // Increments the reference count of this object. The reference count must | 62 // Increments the reference count of this object. The reference count must |
59 // be incremented if this interface is given to another component. | 63 // be incremented if this interface is given to another component. |
60 virtual void AddRef() = 0; | 64 virtual void AddRef() = 0; |
61 | 65 |
62 // Decrements the reference count of this object. When the reference count | 66 // Decrements the reference count of this object. When the reference count |
63 // is zero the object is automatically destroyed. | 67 // is zero the object is automatically destroyed. |
64 // Indicates that the caller is done with this interface. After calling | 68 // Indicates that the caller is done with this interface. After calling |
65 // release no other method should be called. | 69 // release no other method should be called. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 // A NULL value for handle_name indicates all handles of the specified type. | 237 // A NULL value for handle_name indicates all handles of the specified type. |
234 // An empty string for handle_name indicates the handle is unnamed. | 238 // An empty string for handle_name indicates the handle is unnamed. |
235 virtual ResultCode AddKernelObjectToClose(const wchar_t* handle_type, | 239 virtual ResultCode AddKernelObjectToClose(const wchar_t* handle_type, |
236 const wchar_t* handle_name) = 0; | 240 const wchar_t* handle_name) = 0; |
237 }; | 241 }; |
238 | 242 |
239 } // namespace sandbox | 243 } // namespace sandbox |
240 | 244 |
241 | 245 |
242 #endif // SANDBOX_WIN_SRC_SANDBOX_POLICY_H_ | 246 #endif // SANDBOX_WIN_SRC_SANDBOX_POLICY_H_ |
OLD | NEW |