1 // Copyright 2013 The Chromium Embedded Framework Authors. Portions Copyright 2 // 2011 the Chromium Authors. All rights reserved. Use of this source code is 3 // governed by a BSD-style license that can be found in the LICENSE file. 4 5 #include "base/logging.h" 6 #include "sandbox/win/src/process_mitigations.h" 7 #include "sandbox/win/src/sandbox_factory.h" 8 9 #include "cef/libcef/features/features.h" 10 #include "include/cef_sandbox_win.h" 11 12 namespace { 13 14 // From content/app/startup_helper_win.cc: InitializeSandboxInfo(sandbox::SandboxInterfaceInfo * info)15void InitializeSandboxInfo(sandbox::SandboxInterfaceInfo* info) { 16 info->broker_services = sandbox::SandboxFactory::GetBrokerServices(); 17 if (!info->broker_services) { 18 info->target_services = sandbox::SandboxFactory::GetTargetServices(); 19 } else { 20 // Ensure the proper mitigations are enforced for the browser process. 21 sandbox::ApplyProcessMitigationsToCurrentProcess( 22 sandbox::MITIGATION_DEP | sandbox::MITIGATION_DEP_NO_ATL_THUNK | 23 sandbox::MITIGATION_HARDEN_TOKEN_IL_POLICY); 24 // Note: these mitigations are "post-startup". Some mitigations that need 25 // to be enabled sooner (e.g. MITIGATION_EXTENSION_POINT_DISABLE) are done 26 // so in Chrome_ELF. 27 } 28 } 29 30 } // namespace 31 cef_sandbox_info_create()32void* cef_sandbox_info_create() { 33 sandbox::SandboxInterfaceInfo* info = new sandbox::SandboxInterfaceInfo(); 34 memset(info, 0, sizeof(sandbox::SandboxInterfaceInfo)); 35 InitializeSandboxInfo(info); 36 return info; 37 } 38 cef_sandbox_info_destroy(void * sandbox_info)39void cef_sandbox_info_destroy(void* sandbox_info) { 40 delete static_cast<sandbox::SandboxInterfaceInfo*>(sandbox_info); 41 } 42