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 <windows.h> |
9 | |
10 #include <list> | |
11 #include <vector> | |
9 | 12 |
10 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/compiler_specific.h" | |
11 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
16 #include "base/win/scoped_handle.h" | |
17 #include "sandbox/win/src/app_container.h" | |
18 #include "sandbox/win/src/crosscall_server.h" | |
19 #include "sandbox/win/src/handle_closer.h" | |
20 #include "sandbox/win/src/ipc_tags.h" | |
21 #include "sandbox/win/src/policy_engine_opcodes.h" | |
22 #include "sandbox/win/src/policy_engine_params.h" | |
23 #include "sandbox/win/src/policy_low_level.h" | |
24 #include "sandbox/win/src/sandbox_policy.h" | |
12 #include "sandbox/win/src/sandbox_types.h" | 25 #include "sandbox/win/src/sandbox_types.h" |
13 #include "sandbox/win/src/security_level.h" | 26 #include "sandbox/win/src/security_level.h" |
27 #include "sandbox/win/src/target_process.h" | |
28 #include "sandbox/win/src/win_utils.h" | |
14 | 29 |
15 namespace sandbox { | 30 namespace sandbox { |
16 | 31 |
32 typedef std::vector<base::win::ScopedHandle*> HandleList; | |
33 | |
34 // A Windows sandbox policy. All public methods are virtual since they may be | |
35 // called from a dll, while the implementation of the methods lives in the main | |
36 // exe. | |
17 class TargetPolicy { | 37 class TargetPolicy { |
18 public: | 38 public: |
39 TargetPolicy(); | |
40 | |
cpu_(ooo_6.6-7.5)
2016/01/06 18:09:40
Advance apologies for the rambling nature of the c
| |
19 // Windows subsystems that can have specific rules. | 41 // Windows subsystems that can have specific rules. |
20 // Note: The process subsystem(SUBSY_PROCESS) does not evaluate the request | 42 // 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 | 43 // exactly like the CreateProcess API does. See the comment at the top of |
22 // process_thread_dispatcher.cc for more details. | 44 // process_thread_dispatcher.cc for more details. |
23 enum SubSystem { | 45 enum SubSystem { |
24 SUBSYS_FILES, // Creation and opening of files and pipes. | 46 SUBSYS_FILES, // Creation and opening of files and pipes. |
25 SUBSYS_NAMED_PIPES, // Creation of named pipes. | 47 SUBSYS_NAMED_PIPES, // Creation of named pipes. |
26 SUBSYS_PROCESS, // Creation of child processes. | 48 SUBSYS_PROCESS, // Creation of child processes. |
27 SUBSYS_REGISTRY, // Creation and opening of registry keys. | 49 SUBSYS_REGISTRY, // Creation and opening of registry keys. |
28 SUBSYS_SYNC, // Creation of named sync objects. | 50 SUBSYS_SYNC, // Creation of named sync objects. |
(...skipping 25 matching lines...) Expand all Loading... | |
54 EVENTS_ALLOW_READONLY, // Allows opening an even with synchronize access. | 76 EVENTS_ALLOW_READONLY, // Allows opening an even with synchronize access. |
55 REG_ALLOW_READONLY, // Allows readonly access to a registry key. | 77 REG_ALLOW_READONLY, // Allows readonly access to a registry key. |
56 REG_ALLOW_ANY, // Allows read and write access to a registry key. | 78 REG_ALLOW_ANY, // Allows read and write access to a registry key. |
57 FAKE_USER_GDI_INIT // Fakes user32 and gdi32 initialization. This can | 79 FAKE_USER_GDI_INIT // Fakes user32 and gdi32 initialization. This can |
58 // be used to allow the DLLs to load and initialize | 80 // be used to allow the DLLs to load and initialize |
59 // even if the process cannot access that subsystem. | 81 // even if the process cannot access that subsystem. |
60 }; | 82 }; |
61 | 83 |
62 // Increments the reference count of this object. The reference count must | 84 // Increments the reference count of this object. The reference count must |
63 // be incremented if this interface is given to another component. | 85 // be incremented if this interface is given to another component. |
64 virtual void AddRef() = 0; | 86 virtual void AddRef(); |
65 | 87 |
66 // Decrements the reference count of this object. When the reference count | 88 // Decrements the reference count of this object. When the reference count |
67 // is zero the object is automatically destroyed. | 89 // is zero the object is automatically destroyed. |
68 // Indicates that the caller is done with this interface. After calling | 90 // Indicates that the caller is done with this interface. After calling |
69 // release no other method should be called. | 91 // release no other method should be called. |
70 virtual void Release() = 0; | 92 virtual void Release(); |
71 | 93 |
72 // Sets the security level for the target process' two tokens. | 94 // Sets the security level for the target process' two tokens. |
73 // This setting is permanent and cannot be changed once the target process is | 95 // This setting is permanent and cannot be changed once the target process is |
74 // spawned. | 96 // spawned. |
75 // initial: the security level for the initial token. This is the token that | 97 // initial: the security level for the initial token. This is the token that |
76 // is used by the process from the creation of the process until the moment | 98 // is used by the process from the creation of the process until the moment |
77 // the process calls TargetServices::LowerToken() or the process calls | 99 // the process calls TargetServices::LowerToken() or the process calls |
78 // win32's RevertToSelf(). Once this happens the initial token is no longer | 100 // win32's RevertToSelf(). Once this happens the initial token is no longer |
79 // available and the lockdown token is in effect. Using an initial token is | 101 // available and the lockdown token is in effect. Using an initial token is |
80 // not compatible with AppContainer, see SetAppContainer. | 102 // not compatible with AppContainer, see SetAppContainer. |
81 // lockdown: the security level for the token that comes into force after the | 103 // lockdown: the security level for the token that comes into force after the |
82 // process calls TargetServices::LowerToken() or the process calls | 104 // process calls TargetServices::LowerToken() or the process calls |
83 // RevertToSelf(). See the explanation of each level in the TokenLevel | 105 // RevertToSelf(). See the explanation of each level in the TokenLevel |
84 // definition. | 106 // definition. |
85 // Return value: SBOX_ALL_OK if the setting succeeds and false otherwise. | 107 // Return value: SBOX_ALL_OK if the setting succeeds and false otherwise. |
86 // Returns false if the lockdown value is more permissive than the initial | 108 // Returns false if the lockdown value is more permissive than the initial |
87 // value. | 109 // value. |
88 // | 110 // |
89 // Important: most of the sandbox-provided security relies on this single | 111 // Important: most of the sandbox-provided security relies on this single |
90 // setting. The caller should strive to set the lockdown level as restricted | 112 // setting. The caller should strive to set the lockdown level as restricted |
91 // as possible. | 113 // as possible. |
92 virtual ResultCode SetTokenLevel(TokenLevel initial, TokenLevel lockdown) = 0; | 114 virtual ResultCode SetTokenLevel(TokenLevel initial, TokenLevel lockdown); |
93 | 115 |
94 // Returns the initial token level. | 116 // Returns the initial token level. |
95 virtual TokenLevel GetInitialTokenLevel() const = 0; | 117 virtual TokenLevel GetInitialTokenLevel() const; |
96 | 118 |
97 // Returns the lockdown token level. | 119 // Returns the lockdown token level. |
98 virtual TokenLevel GetLockdownTokenLevel() const = 0; | 120 virtual TokenLevel GetLockdownTokenLevel() const; |
99 | 121 |
100 // Sets the security level of the Job Object to which the target process will | 122 // Sets the security level of the Job Object to which the target process will |
101 // belong. This setting is permanent and cannot be changed once the target | 123 // belong. This setting is permanent and cannot be changed once the target |
102 // process is spawned. The job controls the global security settings which | 124 // process is spawned. The job controls the global security settings which |
103 // can not be specified in the token security profile. | 125 // can not be specified in the token security profile. |
104 // job_level: the security level for the job. See the explanation of each | 126 // job_level: the security level for the job. See the explanation of each |
105 // level in the JobLevel definition. | 127 // level in the JobLevel definition. |
106 // ui_exceptions: specify what specific rights that are disabled in the | 128 // ui_exceptions: specify what specific rights that are disabled in the |
107 // chosen job_level that need to be granted. Use this parameter to avoid | 129 // chosen job_level that need to be granted. Use this parameter to avoid |
108 // selecting the next permissive job level unless you need all the rights | 130 // selecting the next permissive job level unless you need all the rights |
(...skipping 14 matching lines...) Expand all Loading... | |
123 // JOB_OBJECT_UILIMIT_DESKTOP : allow the creation of new desktops. | 145 // JOB_OBJECT_UILIMIT_DESKTOP : allow the creation of new desktops. |
124 // JOB_OBJECT_UILIMIT_EXITWINDOWS : allow the call to ExitWindows(). | 146 // JOB_OBJECT_UILIMIT_EXITWINDOWS : allow the call to ExitWindows(). |
125 // | 147 // |
126 // Return value: SBOX_ALL_OK if the setting succeeds and false otherwise. | 148 // Return value: SBOX_ALL_OK if the setting succeeds and false otherwise. |
127 // | 149 // |
128 // Note: JOB_OBJECT_XXXX constants are defined in winnt.h and documented at | 150 // Note: JOB_OBJECT_XXXX constants are defined in winnt.h and documented at |
129 // length in: | 151 // length in: |
130 // http://msdn2.microsoft.com/en-us/library/ms684152.aspx | 152 // http://msdn2.microsoft.com/en-us/library/ms684152.aspx |
131 // | 153 // |
132 // Note: the recommended level is JOB_RESTRICTED or JOB_LOCKDOWN. | 154 // Note: the recommended level is JOB_RESTRICTED or JOB_LOCKDOWN. |
133 virtual ResultCode SetJobLevel(JobLevel job_level, uint32 ui_exceptions) = 0; | 155 virtual ResultCode SetJobLevel(JobLevel job_level, uint32 ui_exceptions); |
134 | 156 |
135 // Sets a hard limit on the size of the commit set for the sandboxed process. | 157 // Sets a hard limit on the size of the commit set for the sandboxed process. |
136 // If the limit is reached, the process will be terminated with | 158 // If the limit is reached, the process will be terminated with |
137 // SBOX_FATAL_MEMORY_EXCEEDED (7012). | 159 // SBOX_FATAL_MEMORY_EXCEEDED (7012). |
138 virtual ResultCode SetJobMemoryLimit(size_t memory_limit) = 0; | 160 virtual ResultCode SetJobMemoryLimit(size_t memory_limit); |
139 | 161 |
140 // Specifies the desktop on which the application is going to run. If the | 162 // Specifies the desktop on which the application is going to run. If the |
141 // desktop does not exist, it will be created. If alternate_winstation is | 163 // desktop does not exist, it will be created. If alternate_winstation is |
142 // set to true, the desktop will be created on an alternate window station. | 164 // set to true, the desktop will be created on an alternate window station. |
143 virtual ResultCode SetAlternateDesktop(bool alternate_winstation) = 0; | 165 virtual ResultCode SetAlternateDesktop(bool alternate_winstation); |
144 | 166 |
145 // Returns the name of the alternate desktop used. If an alternate window | 167 // Returns the name of the alternate desktop used. If an alternate window |
146 // station is specified, the name is prepended by the window station name, | 168 // station is specified, the name is prepended by the window station name, |
147 // followed by a backslash. | 169 // followed by a backslash. |
148 virtual base::string16 GetAlternateDesktop() const = 0; | 170 virtual base::string16 GetAlternateDesktop() const; |
149 | 171 |
150 // Precreates the desktop and window station, if any. | 172 // Precreates the desktop and window station, if any. |
151 virtual ResultCode CreateAlternateDesktop(bool alternate_winstation) = 0; | 173 virtual ResultCode CreateAlternateDesktop(bool alternate_winstation); |
152 | 174 |
153 // Destroys the desktop and windows station. | 175 // Destroys the desktop and windows station. |
154 virtual void DestroyAlternateDesktop() = 0; | 176 virtual void DestroyAlternateDesktop(); |
155 | 177 |
156 // Sets the integrity level of the process in the sandbox. Both the initial | 178 // Sets the integrity level of the process in the sandbox. Both the initial |
157 // token and the main token will be affected by this. If the integrity level | 179 // token and the main token will be affected by this. If the integrity level |
158 // is set to a level higher than the current level, the sandbox will fail | 180 // is set to a level higher than the current level, the sandbox will fail |
159 // to start. | 181 // to start. |
160 virtual ResultCode SetIntegrityLevel(IntegrityLevel level) = 0; | 182 virtual ResultCode SetIntegrityLevel(IntegrityLevel level); |
161 | 183 |
162 // Returns the initial integrity level used. | 184 // Returns the initial integrity level used. |
163 virtual IntegrityLevel GetIntegrityLevel() const = 0; | 185 virtual IntegrityLevel GetIntegrityLevel() const; |
164 | 186 |
165 // Sets the integrity level of the process in the sandbox. The integrity level | 187 // Sets the integrity level of the process in the sandbox. The integrity level |
166 // will not take effect before you call LowerToken. User Interface Privilege | 188 // will not take effect before you call LowerToken. User Interface Privilege |
167 // Isolation is not affected by this setting and will remain off for the | 189 // Isolation is not affected by this setting and will remain off for the |
168 // process in the sandbox. If the integrity level is set to a level higher | 190 // process in the sandbox. If the integrity level is set to a level higher |
169 // than the current level, the sandbox will fail to start. | 191 // than the current level, the sandbox will fail to start. |
170 virtual ResultCode SetDelayedIntegrityLevel(IntegrityLevel level) = 0; | 192 virtual ResultCode SetDelayedIntegrityLevel(IntegrityLevel level); |
171 | 193 |
172 // Sets the AppContainer to be used for the sandboxed process. Any capability | 194 // Sets the AppContainer to be used for the sandboxed process. Any capability |
173 // to be enabled for the process should be added before this method is invoked | 195 // to be enabled for the process should be added before this method is invoked |
174 // (by calling SetCapability() as many times as needed). | 196 // (by calling SetCapability() as many times as needed). |
175 // The desired AppContainer must be already installed on the system, otherwise | 197 // The desired AppContainer must be already installed on the system, otherwise |
176 // launching the sandboxed process will fail. See BrokerServices for details | 198 // launching the sandboxed process will fail. See BrokerServices for details |
177 // about installing an AppContainer. | 199 // about installing an AppContainer. |
178 // Note that currently Windows restricts the use of impersonation within | 200 // Note that currently Windows restricts the use of impersonation within |
179 // AppContainers, so this function is incompatible with the use of an initial | 201 // AppContainers, so this function is incompatible with the use of an initial |
180 // token. | 202 // token. |
181 virtual ResultCode SetAppContainer(const wchar_t* sid) = 0; | 203 virtual ResultCode SetAppContainer(const wchar_t* sid); |
182 | 204 |
183 // Sets a capability to be enabled for the sandboxed process' AppContainer. | 205 // Sets a capability to be enabled for the sandboxed process' AppContainer. |
184 virtual ResultCode SetCapability(const wchar_t* sid) = 0; | 206 virtual ResultCode SetCapability(const wchar_t* sid); |
185 | 207 |
186 // Sets the LowBox token for sandboxed process. This is mutually exclusive | 208 // Sets the LowBox token for sandboxed process. This is mutually exclusive |
187 // with SetAppContainer method. | 209 // with SetAppContainer method. |
188 virtual ResultCode SetLowBox(const wchar_t* sid) = 0; | 210 virtual ResultCode SetLowBox(const wchar_t* sid); |
189 | 211 |
190 // Sets the mitigations enabled when the process is created. Most of these | 212 // Sets the mitigations enabled when the process is created. Most of these |
191 // are implemented as attributes passed via STARTUPINFOEX. So they take | 213 // are implemented as attributes passed via STARTUPINFOEX. So they take |
192 // effect before any thread in the target executes. The declaration of | 214 // effect before any thread in the target executes. The declaration of |
193 // MitigationFlags is followed by a detailed description of each flag. | 215 // MitigationFlags is followed by a detailed description of each flag. |
194 virtual ResultCode SetProcessMitigations(MitigationFlags flags) = 0; | 216 virtual ResultCode SetProcessMitigations(MitigationFlags flags); |
195 | 217 |
196 // Returns the currently set mitigation flags. | 218 // Returns the currently set mitigation flags. |
197 virtual MitigationFlags GetProcessMitigations() = 0; | 219 virtual MitigationFlags GetProcessMitigations(); |
198 | 220 |
199 // Sets process mitigation flags that don't take effect before the call to | 221 // Sets process mitigation flags that don't take effect before the call to |
200 // LowerToken(). | 222 // LowerToken(). |
201 virtual ResultCode SetDelayedProcessMitigations(MitigationFlags flags) = 0; | 223 virtual ResultCode SetDelayedProcessMitigations(MitigationFlags flags); |
202 | 224 |
203 // Returns the currently set delayed mitigation flags. | 225 // Returns the currently set delayed mitigation flags. |
204 virtual MitigationFlags GetDelayedProcessMitigations() const = 0; | 226 virtual MitigationFlags GetDelayedProcessMitigations() const; |
205 | 227 |
206 // Sets the interceptions to operate in strict mode. By default, interceptions | 228 // Sets the interceptions to operate in strict mode. By default, interceptions |
207 // are performed in "relaxed" mode, where if something inside NTDLL.DLL is | 229 // are performed in "relaxed" mode, where if something inside NTDLL.DLL is |
208 // already patched we attempt to intercept it anyway. Setting interceptions | 230 // already patched we attempt to intercept it anyway. Setting interceptions |
209 // to strict mode means that when we detect that the function is patched we'll | 231 // to strict mode means that when we detect that the function is patched we'll |
210 // refuse to perform the interception. | 232 // refuse to perform the interception. |
211 virtual void SetStrictInterceptions() = 0; | 233 void SetStrictInterceptions(); |
212 | 234 |
213 // Set the handles the target process should inherit for stdout and | 235 // Set the handles the target process should inherit for stdout and |
214 // stderr. The handles the caller passes must remain valid for the | 236 // stderr. The handles the caller passes must remain valid for the |
215 // lifetime of the policy object. This only has an effect on | 237 // lifetime of the policy object. This only has an effect on |
216 // Windows Vista and later versions. These methods accept pipe and | 238 // Windows Vista and later versions. These methods accept pipe and |
217 // file handles, but not console handles. | 239 // file handles, but not console handles. |
218 virtual ResultCode SetStdoutHandle(HANDLE handle) = 0; | 240 virtual ResultCode SetStdoutHandle(HANDLE handle); |
219 virtual ResultCode SetStderrHandle(HANDLE handle) = 0; | 241 virtual ResultCode SetStderrHandle(HANDLE handle); |
220 | 242 |
221 // Adds a policy rule effective for processes spawned using this policy. | 243 // Adds a policy rule effective for processes spawned using this policy. |
222 // subsystem: One of the above enumerated windows subsystems. | 244 // subsystem: One of the above enumerated windows subsystems. |
223 // semantics: One of the above enumerated FileSemantics. | 245 // semantics: One of the above enumerated FileSemantics. |
224 // pattern: A specific full path or a full path with wildcard patterns. | 246 // pattern: A specific full path or a full path with wildcard patterns. |
225 // The valid wildcards are: | 247 // The valid wildcards are: |
226 // '*' : Matches zero or more character. Only one in series allowed. | 248 // '*' : Matches zero or more character. Only one in series allowed. |
227 // '?' : Matches a single character. One or more in series are allowed. | 249 // '?' : Matches a single character. One or more in series are allowed. |
228 // Examples: | 250 // Examples: |
229 // "c:\\documents and settings\\vince\\*.dmp" | 251 // "c:\\documents and settings\\vince\\*.dmp" |
230 // "c:\\documents and settings\\*\\crashdumps\\*.dmp" | 252 // "c:\\documents and settings\\*\\crashdumps\\*.dmp" |
231 // "c:\\temp\\app_log_?????_chrome.txt" | 253 // "c:\\temp\\app_log_?????_chrome.txt" |
232 virtual ResultCode AddRule(SubSystem subsystem, Semantics semantics, | 254 virtual ResultCode AddRule(SubSystem subsystem, |
233 const wchar_t* pattern) = 0; | 255 Semantics semantics, |
256 const wchar_t* pattern); | |
234 | 257 |
235 // Adds a dll that will be unloaded in the target process before it gets | 258 // Adds a dll that will be unloaded in the target process before it gets |
236 // a chance to initialize itself. Typically, dlls that cause the target | 259 // a chance to initialize itself. Typically, dlls that cause the target |
237 // to crash go here. | 260 // to crash go here. |
238 virtual ResultCode AddDllToUnload(const wchar_t* dll_name) = 0; | 261 virtual ResultCode AddDllToUnload(const wchar_t* dll_name); |
239 | 262 |
240 // Adds a handle that will be closed in the target process after lockdown. | 263 // Adds a handle that will be closed in the target process after lockdown. |
241 // A NULL value for handle_name indicates all handles of the specified type. | 264 // A NULL value for handle_name indicates all handles of the specified type. |
242 // An empty string for handle_name indicates the handle is unnamed. | 265 // An empty string for handle_name indicates the handle is unnamed. |
243 virtual ResultCode AddKernelObjectToClose(const wchar_t* handle_type, | 266 virtual ResultCode AddKernelObjectToClose(const wchar_t* handle_type, |
244 const wchar_t* handle_name) = 0; | 267 const wchar_t* handle_name); |
245 | 268 |
246 // Adds a handle that will be shared with the target process. | 269 // Adds a handle that will be shared with the target process. |
247 // Returns the handle which was actually shared with the target. This is | 270 // 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 | 271 // achieved by duplicating the handle to ensure that it is inheritable by |
249 // the target. The caller should treat this as an opaque value. | 272 // the target. The caller should treat this as an opaque value. |
250 virtual void* AddHandleToShare(HANDLE handle) = 0; | 273 virtual void* AddHandleToShare(HANDLE handle); |
274 | |
275 // Creates a Job object with the level specified in a previous call to | |
276 // SetJobLevel(). | |
277 virtual ResultCode MakeJobObject(base::win::ScopedHandle* job); | |
278 | |
279 // Creates the two tokens with the levels specified in a previous call to | |
280 // SetTokenLevel(). Also creates a lowbox token if specified based on the | |
281 // lowbox SID. | |
282 virtual ResultCode MakeTokens(base::win::ScopedHandle* initial, | |
283 base::win::ScopedHandle* lockdown, | |
284 base::win::ScopedHandle* lowbox); | |
285 | |
286 virtual const AppContainerAttributes* GetAppContainer() const; | |
287 | |
288 virtual PSID GetLowBoxSid() const; | |
289 | |
290 // Adds a target process to the internal list of targets. Internally a | |
291 // call to TargetProcess::Init() is issued. | |
292 virtual bool AddTarget(TargetProcess* target); | |
293 | |
294 // Called when there are no more active processes in a Job. | |
295 // Removes a Job object associated with this policy and the target associated | |
296 // with the job. | |
297 virtual bool OnJobEmpty(HANDLE job); | |
298 | |
299 virtual EvalResult EvalPolicy(int service, CountedParameterSetBase* params); | |
300 | |
301 virtual HANDLE GetStdoutHandle(); | |
302 virtual HANDLE GetStderrHandle(); | |
303 | |
304 // Returns the list of handles being shared with the target process. | |
305 virtual const HandleList& GetHandlesBeingShared(); | |
306 | |
307 // Closes the handles being shared with the target and clears out the list. | |
308 virtual void ClearSharedHandles(); | |
309 | |
310 private: | |
311 friend class base::RefCountedThreadSafe<TargetPolicy>; | |
312 ~TargetPolicy(); | |
313 | |
314 // Sets up interceptions for a new target. | |
315 bool SetupAllInterceptions(TargetProcess* target); | |
316 | |
317 // Sets up the handle closer for a new target. | |
318 bool SetupHandleCloser(TargetProcess* target); | |
319 | |
320 ResultCode AddRuleInternal(SubSystem subsystem, | |
321 Semantics semantics, | |
322 const wchar_t* pattern); | |
323 | |
324 // This lock synchronizes operations on the targets_ collection. | |
325 CRITICAL_SECTION lock_; | |
326 | |
327 // Maintains the list of target process associated with this policy. | |
328 // The policy takes ownership of them. | |
329 typedef std::list<TargetProcess*> TargetSet; | |
330 TargetSet targets_; | |
331 // Standard object-lifetime reference counter. | |
332 volatile LONG ref_count; | |
333 // The user-defined global policy settings. | |
334 TokenLevel lockdown_level_; | |
335 TokenLevel initial_level_; | |
336 JobLevel job_level_; | |
337 uint32 ui_exceptions_; | |
338 size_t memory_limit_; | |
339 bool use_alternate_desktop_; | |
340 bool use_alternate_winstation_; | |
341 // Helps the file system policy initialization. | |
342 bool file_system_init_; | |
343 bool relaxed_interceptions_; | |
344 HANDLE stdout_handle_; | |
345 HANDLE stderr_handle_; | |
346 IntegrityLevel integrity_level_; | |
347 IntegrityLevel delayed_integrity_level_; | |
348 MitigationFlags mitigations_; | |
349 MitigationFlags delayed_mitigations_; | |
350 // Object in charge of generating the low level policy. | |
351 LowLevelPolicy* policy_maker_; | |
352 // Memory structure that stores the low level policy. | |
353 PolicyGlobal* policy_; | |
354 // The list of dlls to unload in the target process. | |
355 std::vector<base::string16> blacklisted_dlls_; | |
356 // This is a map of handle-types to names that we need to close in the | |
357 // target process. A null set means we need to close all handles of the | |
358 // given type. | |
359 HandleCloser handle_closer_; | |
360 std::vector<base::string16> capabilities_; | |
361 scoped_ptr<AppContainerAttributes> appcontainer_list_; | |
362 PSID lowbox_sid_; | |
363 base::win::ScopedHandle lowbox_directory_; | |
364 scoped_ptr<Dispatcher> dispatcher_; | |
365 | |
366 static HDESK alternate_desktop_handle_; | |
367 static HWINSTA alternate_winstation_handle_; | |
368 static IntegrityLevel alternate_desktop_integrity_level_label_; | |
369 | |
370 // Contains the list of handles being shared with the target process. | |
371 // This list contains handles other than the stderr/stdout handles which are | |
372 // shared with the target at times. | |
373 HandleList handles_to_share_; | |
374 | |
375 DISALLOW_COPY_AND_ASSIGN(TargetPolicy); | |
251 }; | 376 }; |
252 | 377 |
253 } // namespace sandbox | 378 } // namespace sandbox |
254 | 379 |
255 | |
256 #endif // SANDBOX_WIN_SRC_SANDBOX_POLICY_H_ | 380 #endif // SANDBOX_WIN_SRC_SANDBOX_POLICY_H_ |
OLD | NEW |