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 #include "content/common/sandbox_win.h" | 5 #include "content/common/sandbox_win.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_HANDLES, | 344 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_HANDLES, |
345 sandbox::TargetPolicy::HANDLES_DUP_ANY, | 345 sandbox::TargetPolicy::HANDLES_DUP_ANY, |
346 L"Event"); | 346 L"Event"); |
347 if (result != sandbox::SBOX_ALL_OK) | 347 if (result != sandbox::SBOX_ALL_OK) |
348 return false; | 348 return false; |
349 | 349 |
350 // Win8+ adds a device DeviceApi that we don't need. | 350 // Win8+ adds a device DeviceApi that we don't need. |
351 if (base::win::GetVersion() > base::win::VERSION_WIN7) | 351 if (base::win::GetVersion() > base::win::VERSION_WIN7) |
352 policy->AddKernelObjectToClose(L"File", L"\\Device\\DeviceApi"); | 352 policy->AddKernelObjectToClose(L"File", L"\\Device\\DeviceApi"); |
353 | 353 |
| 354 // Close the proxy settings on XP. |
| 355 if (base::win::GetVersion() <= base::win::VERSION_SERVER_2003) |
| 356 policy->AddKernelObjectToClose(L"Key", |
| 357 L"HKCU\\Software\\Microsoft\\Windows\\" \ |
| 358 L"CurrentVersion\\Internet Settings"); |
| 359 |
354 sandbox::TokenLevel initial_token = sandbox::USER_UNPROTECTED; | 360 sandbox::TokenLevel initial_token = sandbox::USER_UNPROTECTED; |
355 if (base::win::GetVersion() > base::win::VERSION_XP) { | 361 if (base::win::GetVersion() > base::win::VERSION_XP) { |
356 // On 2003/Vista the initial token has to be restricted if the main | 362 // On 2003/Vista the initial token has to be restricted if the main |
357 // token is restricted. | 363 // token is restricted. |
358 initial_token = sandbox::USER_RESTRICTED_SAME_ACCESS; | 364 initial_token = sandbox::USER_RESTRICTED_SAME_ACCESS; |
359 } | 365 } |
360 | 366 |
361 policy->SetTokenLevel(initial_token, sandbox::USER_LOCKDOWN); | 367 policy->SetTokenLevel(initial_token, sandbox::USER_LOCKDOWN); |
362 // Prevents the renderers from manipulating low-integrity processes. | 368 // Prevents the renderers from manipulating low-integrity processes. |
363 policy->SetDelayedIntegrityLevel(sandbox::INTEGRITY_LEVEL_UNTRUSTED); | 369 policy->SetDelayedIntegrityLevel(sandbox::INTEGRITY_LEVEL_UNTRUSTED); |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 } | 781 } |
776 | 782 |
777 return false; | 783 return false; |
778 } | 784 } |
779 | 785 |
780 bool BrokerAddTargetPeer(HANDLE peer_process) { | 786 bool BrokerAddTargetPeer(HANDLE peer_process) { |
781 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 787 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
782 } | 788 } |
783 | 789 |
784 } // namespace content | 790 } // namespace content |
OLD | NEW |