Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Unified Diff: chrome_elf/chrome_elf_util_unittest.cc

Issue 1656453002: [Chrome ELF] Early browser security support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review changes, part 1. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« chrome_elf/chrome_elf_util.cc ('K') | « chrome_elf/chrome_elf_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_elf/chrome_elf_util_unittest.cc
diff --git a/chrome_elf/chrome_elf_util_unittest.cc b/chrome_elf/chrome_elf_util_unittest.cc
index 565785f95d6cd9020a5379d625118cdf0d15cbe1..1d9e23c8f5f05608c817d9d3f18f30900272364f 100644
--- a/chrome_elf/chrome_elf_util_unittest.cc
+++ b/chrome_elf/chrome_elf_util_unittest.cc
@@ -5,6 +5,8 @@
#include "chrome_elf/chrome_elf_util.h"
#include <tuple>
+#include <windows.h>
+#include <versionhelpers.h> // windows.h must be before.
#include "base/test/test_reg_util_win.h"
#include "base/win/registry.h"
@@ -36,6 +38,30 @@ const wchar_t kChromeUserExePath[] =
const wchar_t kChromiumExePath[] =
L"C:\\Users\\user\\AppData\\Local\\Chromium\\Application\\chrome.exe";
+typedef decltype(GetProcessMitigationPolicy)* GetProcessMitigationPolicyFunc;
+
+bool IsSecuritySet() {
+ // Check the settings from EarlyBrowserSecurity().
+ if (::IsWindows8OrGreater()) {
+ GetProcessMitigationPolicyFunc get_process_mitigation_policy =
+ reinterpret_cast<GetProcessMitigationPolicyFunc>(::GetProcAddress(
+ ::GetModuleHandleW(L"kernel32.dll"), "GetProcessMitigationPolicy"));
+ if (!get_process_mitigation_policy)
+ return false;
+
+ // Check that extension DLLs are disabled.
+ // (Legacy hooking.)
+ PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY policy = {};
+ if (!get_process_mitigation_policy(::GetCurrentProcess(),
+ ProcessExtensionPointDisablePolicy,
+ &policy, sizeof(policy)))
+ return false;
+
+ return policy.DisableExtensionPoints;
+ }
+
+ return true;
+}
TEST(ChromeElfUtilTest, CanaryTest) {
EXPECT_TRUE(IsCanary(kCanaryExePath));
@@ -54,6 +80,11 @@ TEST(ChromeElfUtilTest, BrowserProcessTest) {
EXPECT_FALSE(IsNonBrowserProcess());
}
+TEST(ChromeElfUtilTest, BrowserProcessSecurityTest) {
+ EarlyBrowserSecurity();
+ EXPECT_TRUE(IsSecuritySet());
+}
+
// Parameterized test with paramters:
// 1: product: "canary" or "google"
// 2: install level: "user" or "system"
« chrome_elf/chrome_elf_util.cc ('K') | « chrome_elf/chrome_elf_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698