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 SUBSYS_WIN32K_LOCKDOWN, // Win32K Lockdown related policy. |
| 31 SUBSYS_LPC // LPC related policy. |
31 }; | 32 }; |
32 | 33 |
33 // Allowable semantics when a rule is matched. | 34 // Allowable semantics when a rule is matched. |
34 enum Semantics { | 35 enum Semantics { |
35 FILES_ALLOW_ANY, // Allows open or create for any kind of access that | 36 FILES_ALLOW_ANY, // Allows open or create for any kind of access that |
36 // the file system supports. | 37 // the file system supports. |
37 FILES_ALLOW_READONLY, // Allows open or create with read access only. | 38 FILES_ALLOW_READONLY, // Allows open or create with read access only. |
38 FILES_ALLOW_QUERY, // Allows access to query the attributes of a file. | 39 FILES_ALLOW_QUERY, // Allows access to query the attributes of a file. |
39 FILES_ALLOW_DIR_ANY, // Allows open or create with directory semantics | 40 FILES_ALLOW_DIR_ANY, // Allows open or create with directory semantics |
40 // only. | 41 // only. |
41 HANDLES_DUP_ANY, // Allows duplicating handles opened with any | 42 HANDLES_DUP_ANY, // Allows duplicating handles opened with any |
42 // access permissions. | 43 // access permissions. |
43 HANDLES_DUP_BROKER, // Allows duplicating handles to the broker process. | 44 HANDLES_DUP_BROKER, // Allows duplicating handles to the broker process. |
44 NAMEDPIPES_ALLOW_ANY, // Allows creation of a named pipe. | 45 NAMEDPIPES_ALLOW_ANY, // Allows creation of a named pipe. |
45 PROCESS_MIN_EXEC, // Allows to create a process with minimal rights | 46 PROCESS_MIN_EXEC, // Allows to create a process with minimal rights |
46 // over the resulting process and thread handles. | 47 // over the resulting process and thread handles. |
47 // No other parameters besides the command line are | 48 // No other parameters besides the command line are |
48 // passed to the child process. | 49 // passed to the child process. |
49 PROCESS_ALL_EXEC, // Allows the creation of a process and return fill | 50 PROCESS_ALL_EXEC, // Allows the creation of a process and return fill |
50 // access on the returned handles. | 51 // access on the returned handles. |
51 // This flag can be used only when the main token of | 52 // This flag can be used only when the main token of |
52 // the sandboxed application is at least INTERACTIVE. | 53 // the sandboxed application is at least INTERACTIVE. |
53 EVENTS_ALLOW_ANY, // Allows the creation of an event with full access. | 54 EVENTS_ALLOW_ANY, // Allows the creation of an event with full access. |
54 EVENTS_ALLOW_READONLY, // Allows opening an even with synchronize access. | 55 EVENTS_ALLOW_READONLY, // Allows opening an even with synchronize access. |
55 REG_ALLOW_READONLY, // Allows readonly access to a registry key. | 56 REG_ALLOW_READONLY, // Allows readonly access to a registry key. |
56 REG_ALLOW_ANY, // Allows read and write access to a registry key. | 57 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 FAKE_USER_GDI_INIT, // Fakes user32 and gdi32 initialization. This can |
58 // be used to allow the DLLs to load and initialize | 59 // be used to allow the DLLs to load and initialize |
59 // even if the process cannot access that subsystem. | 60 // even if the process cannot access that subsystem. |
| 61 ALPC_CONNECT_ALLOW // Allows connecting to specified ALPC ports. |
60 }; | 62 }; |
61 | 63 |
62 // Increments the reference count of this object. The reference count must | 64 // Increments the reference count of this object. The reference count must |
63 // be incremented if this interface is given to another component. | 65 // be incremented if this interface is given to another component. |
64 virtual void AddRef() = 0; | 66 virtual void AddRef() = 0; |
65 | 67 |
66 // Decrements the reference count of this object. When the reference count | 68 // Decrements the reference count of this object. When the reference count |
67 // is zero the object is automatically destroyed. | 69 // is zero the object is automatically destroyed. |
68 // Indicates that the caller is done with this interface. After calling | 70 // Indicates that the caller is done with this interface. After calling |
69 // release no other method should be called. | 71 // release no other method should be called. |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 // Returns the handle which was actually shared with the target. This is | 249 // Returns the handle which was actually shared with the target. This is |
248 // achieved by duplicating the handle to ensure that it is inheritable by | 250 // achieved by duplicating the handle to ensure that it is inheritable by |
249 // the target. The caller should treat this as an opaque value. | 251 // the target. The caller should treat this as an opaque value. |
250 virtual void* AddHandleToShare(HANDLE handle) = 0; | 252 virtual void* AddHandleToShare(HANDLE handle) = 0; |
251 }; | 253 }; |
252 | 254 |
253 } // namespace sandbox | 255 } // namespace sandbox |
254 | 256 |
255 | 257 |
256 #endif // SANDBOX_WIN_SRC_SANDBOX_POLICY_H_ | 258 #endif // SANDBOX_WIN_SRC_SANDBOX_POLICY_H_ |
OLD | NEW |