Commit 45c18bd0 authored by Stephen Nusko's avatar Stephen Nusko Committed by Commit Bot

Revert "Migrate non-inclusive terminology in chrome/browser/win/conflicts."

This reverts commit dedbddfa.

Reason for revert: Breaks windows perf bot compile crbug/1150494

Original change's description:
> Migrate non-inclusive terminology in chrome/browser/win/conflicts.
>
> Bug: 1097283
> Change-Id: Ic54679c9d4b86fbe074b77067bd1bfa8b5d388f4
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2546842
> Commit-Queue: Peter Kasting <pkasting@chromium.org>
> Commit-Queue: Chris Hamilton <chrisha@chromium.org>
> Auto-Submit: Peter Kasting <pkasting@chromium.org>
> Reviewed-by: Chris Hamilton <chrisha@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#828770}

TBR=pkasting@chromium.org,chrisha@chromium.org

Change-Id: Id51371b5e0add5122cd34323c7fc3461d9ad118a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1097283,1150494
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2547049Reviewed-by: default avatarStephen Nusko <nuskos@chromium.org>
Commit-Queue: Stephen Nusko <nuskos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828804}
parent 909e6d5e
......@@ -4764,10 +4764,10 @@ static_library("browser") {
"win/conflicts/incompatible_applications_updater.h",
"win/conflicts/installed_applications.cc",
"win/conflicts/installed_applications.h",
"win/conflicts/module_blocklist_cache_updater.cc",
"win/conflicts/module_blocklist_cache_updater.h",
"win/conflicts/module_blocklist_cache_util.cc",
"win/conflicts/module_blocklist_cache_util.h",
"win/conflicts/module_blacklist_cache_updater.cc",
"win/conflicts/module_blacklist_cache_updater.h",
"win/conflicts/module_blacklist_cache_util.cc",
"win/conflicts/module_blacklist_cache_util.h",
"win/conflicts/module_list_component_updater.cc",
"win/conflicts/module_list_component_updater.h",
"win/conflicts/module_list_filter.cc",
......
......@@ -66,8 +66,8 @@ source_set("unit_tests") {
sources += [
"incompatible_applications_updater_unittest.cc",
"installed_applications_unittest.cc",
"module_blocklist_cache_updater_unittest.cc",
"module_blocklist_cache_util_unittest.cc",
"module_blacklist_cache_updater_unittest.cc",
"module_blacklist_cache_util_unittest.cc",
"module_list_filter_unittest.cc",
"module_load_attempt_log_listener_unittest.cc",
"registry_key_watcher_unittest.cc",
......
......@@ -7,5 +7,5 @@ It has 3 main roles:
1. Detect all DLLs that loads in the browser and renderer processes.
2. Match third-party DLLs to an installed application on the user's computer and
warn the user via chrome://settings/incompatibleApplications
2. Build the module blocklist cache that allows the chrome_elf hook to block
non-allowlisted DLLs.
2. Build the module blacklist cache that allows the chrome_elf hook to block
non-whitelisted DLLs.
......@@ -122,9 +122,9 @@ class IncompatibleApplicationsBrowserTest : public InProcessBrowserTest {
// Writes an empty serialized ModuleList proto to |GetModuleListPath()|.
void CreateModuleList() {
chrome::conflicts::ModuleList module_list;
// Include an empty blocklist and allowlist.
module_list.mutable_blocklist();
module_list.mutable_allowlist();
// Include an empty blacklist and whitelist.
module_list.mutable_blacklist();
module_list.mutable_whitelist();
std::string contents;
ASSERT_TRUE(module_list.SerializeToString(&contents));
......@@ -240,6 +240,6 @@ IN_PROC_BROWSER_TEST_F(IncompatibleApplicationsBrowserTest,
ASSERT_EQ(incompatible_applications.size(), 1u);
const auto& incompatible_application = incompatible_applications[0];
EXPECT_EQ(incompatible_application.info.name, kApplicationName);
EXPECT_EQ(incompatible_application.blocklist_action->message_type(),
chrome::conflicts::BlocklistMessageType::UNINSTALL);
EXPECT_EQ(incompatible_application.blacklist_action->message_type(),
chrome::conflicts::BlacklistMessageType::UNINSTALL);
}
......@@ -54,11 +54,11 @@ base::Value ConvertToDictionary(
// And then the actual information needed to display a warning to the user.
element.SetKey("allow_load",
base::Value(application.blocklist_action->allow_load()));
base::Value(application.blacklist_action->allow_load()));
element.SetKey("type",
base::Value(application.blocklist_action->message_type()));
base::Value(application.blacklist_action->message_type()));
element.SetKey("message_url",
base::Value(application.blocklist_action->message_url()));
base::Value(application.blacklist_action->message_url()));
result.SetKey(base::UTF16ToUTF8(application.info.name), std::move(element));
}
......@@ -101,17 +101,17 @@ ConvertToIncompatibleApplication(const std::string& name,
base::UTF8ToUTF16(registry_key_path_value->GetString()),
static_cast<REGSAM>(registry_wow64_access_value->GetInt())};
auto blocklist_action =
std::make_unique<chrome::conflicts::BlocklistAction>();
blocklist_action->set_allow_load(allow_load_value->GetBool());
blocklist_action->set_message_type(
static_cast<chrome::conflicts::BlocklistMessageType>(
auto blacklist_action =
std::make_unique<chrome::conflicts::BlacklistAction>();
blacklist_action->set_allow_load(allow_load_value->GetBool());
blacklist_action->set_message_type(
static_cast<chrome::conflicts::BlacklistMessageType>(
type_value->GetInt()));
blocklist_action->set_message_url(message_url_value->GetString());
blacklist_action->set_message_url(message_url_value->GetString());
return std::make_unique<
IncompatibleApplicationsUpdater::IncompatibleApplication>(
std::move(application_info), std::move(blocklist_action));
std::move(application_info), std::move(blacklist_action));
}
// Returns true if |application| references an existing application in the
......@@ -225,8 +225,8 @@ void UpdateIncompatibleApplications(
IncompatibleApplicationsUpdater::IncompatibleApplication::
IncompatibleApplication(
InstalledApplications::ApplicationInfo info,
std::unique_ptr<chrome::conflicts::BlocklistAction> blocklist_action)
: info(std::move(info)), blocklist_action(std::move(blocklist_action)) {}
std::unique_ptr<chrome::conflicts::BlacklistAction> blacklist_action)
: info(std::move(info)), blacklist_action(std::move(blacklist_action)) {}
IncompatibleApplicationsUpdater::IncompatibleApplication::
~IncompatibleApplication() = default;
......@@ -351,7 +351,7 @@ void IncompatibleApplicationsUpdater::OnNewModuleFound(
// First check if this module is a part of Chrome.
// Explicitly allowlist modules whose signing cert's Subject field matches the
// Explicitly whitelist modules whose signing cert's Subject field matches the
// one in the current executable. No attempt is made to check the validity of
// module signatures or of signing certs.
if (exe_certificate_info_.type != CertificateInfo::Type::NO_CERTIFICATE &&
......@@ -369,9 +369,9 @@ void IncompatibleApplicationsUpdater::OnNewModuleFound(
return;
}
// allowlist modules in the same directory as the executable. This serves 2
// Whitelist modules in the same directory as the executable. This serves 2
// purposes:
// - In unsigned builds, this allowlists all of the DLL that are part of
// - In unsigned builds, this whitelists all of the DLL that are part of
// Chrome.
// - It avoids an issue with the simple heuristic used to determine to which
// application a DLL belongs. Without this, if an injected third-party DLL
......@@ -384,14 +384,14 @@ void IncompatibleApplicationsUpdater::OnNewModuleFound(
return;
}
// Skip modules allowlisted by the Module List component.
if (module_list_filter_->IsAllowlisted(module_key, module_data)) {
warning_decision = ModuleWarningDecision::kAllowedAllowlisted;
// Skip modules whitelisted by the Module List component.
if (module_list_filter_->IsWhitelisted(module_key, module_data)) {
warning_decision = ModuleWarningDecision::kAllowedWhitelisted;
return;
}
// It is preferable to mark a allowlisted shell extension as allowed because
// it is allowlisted, not because it's a shell extension. Thus, check for the
// It is preferable to mark a whitelisted shell extension as allowed because
// it is whitelisted, not because it's a shell extension. Thus, check for the
// module type after.
if (module_data.module_properties & ModuleInfoData::kPropertyShellExtension) {
warning_decision = ModuleWarningDecision::kAllowedShellExtension;
......@@ -406,8 +406,8 @@ void IncompatibleApplicationsUpdater::OnNewModuleFound(
// Now it has been determined that the module is unwanted. First check if it
// is going to be blocked on the next Chrome launch.
if (module_data.module_properties &
ModuleInfoData::kPropertyAddedToBlocklist) {
warning_decision = ModuleWarningDecision::kAddedToBlocklist;
ModuleInfoData::kPropertyAddedToBlacklist) {
warning_decision = ModuleWarningDecision::kAddedToBlacklist;
return;
}
......@@ -424,22 +424,22 @@ void IncompatibleApplicationsUpdater::OnNewModuleFound(
warning_decision = ModuleWarningDecision::kIncompatible;
std::unique_ptr<chrome::conflicts::BlocklistAction> blocklist_action =
module_list_filter_->IsBlocklisted(module_key, module_data);
if (!blocklist_action) {
std::unique_ptr<chrome::conflicts::BlacklistAction> blacklist_action =
module_list_filter_->IsBlacklisted(module_key, module_data);
if (!blacklist_action) {
// The default behavior is to suggest to uninstall.
blocklist_action = std::make_unique<chrome::conflicts::BlocklistAction>();
blocklist_action->set_allow_load(true);
blocklist_action->set_message_type(
chrome::conflicts::BlocklistMessageType::UNINSTALL);
blocklist_action->set_message_url(std::string());
blacklist_action = std::make_unique<chrome::conflicts::BlacklistAction>();
blacklist_action->set_allow_load(true);
blacklist_action->set_message_type(
chrome::conflicts::BlacklistMessageType::UNINSTALL);
blacklist_action->set_message_url(std::string());
}
for (auto&& associated_application : associated_applications) {
incompatible_applications_.emplace_back(
std::move(associated_application),
std::make_unique<chrome::conflicts::BlocklistAction>(
*blocklist_action));
std::make_unique<chrome::conflicts::BlacklistAction>(
*blacklist_action));
}
}
......
......@@ -31,7 +31,7 @@ class IncompatibleApplicationsUpdater : public ModuleDatabaseObserver {
// incompatibility warning or not.
//
// Note that this enum is very similar to the ModuleBlockingDecision in
// ModuleBlocklistCacheUpdater. This is done so that it is easier to keep the
// ModuleBlacklistCacheUpdater. This is done so that it is easier to keep the
// 2 features separate, as they can be independently enabled/disabled.
enum ModuleWarningDecision {
// No decision was taken yet for the module.
......@@ -55,14 +55,14 @@ class IncompatibleApplicationsUpdater : public ModuleDatabaseObserver {
// Allowed because it is signed by Microsoft. The certificate is not
// validated.
kAllowedMicrosoft,
// Explicitly allowlisted by the Module List component.
kAllowedAllowlisted,
// Explicitly whitelisted by the Module List component.
kAllowedWhitelisted,
// Module analysis was interrupted using DisableModuleAnalysis(). No warning
// will be emitted for that module.
kNotAnalyzed,
// This module is already going to be blocked on next browser launch, so
// don't warn about it.
kAddedToBlocklist,
kAddedToBlacklist,
// Unwanted, but can't tie back to an installed application.
kNoTiedApplication,
// An incompatibility warning will be shown because of this module.
......@@ -72,7 +72,7 @@ class IncompatibleApplicationsUpdater : public ModuleDatabaseObserver {
struct IncompatibleApplication {
IncompatibleApplication(
InstalledApplications::ApplicationInfo info,
std::unique_ptr<chrome::conflicts::BlocklistAction> blocklist_action);
std::unique_ptr<chrome::conflicts::BlacklistAction> blacklist_action);
~IncompatibleApplication();
// Needed for std::remove_if().
......@@ -81,7 +81,7 @@ class IncompatibleApplicationsUpdater : public ModuleDatabaseObserver {
IncompatibleApplication&& incompatible_application);
InstalledApplications::ApplicationInfo info;
std::unique_ptr<chrome::conflicts::BlocklistAction> blocklist_action;
std::unique_ptr<chrome::conflicts::BlacklistAction> blacklist_action;
};
// Creates an instance of the updater.
......
......@@ -26,17 +26,17 @@
namespace {
// Mocks an empty allowlist and blocklist.
// Mocks an empty whitelist and blacklist.
class MockModuleListFilter : public ModuleListFilter {
public:
MockModuleListFilter() = default;
bool IsAllowlisted(base::StringPiece module_basename_hash,
bool IsWhitelisted(base::StringPiece module_basename_hash,
base::StringPiece module_code_id_hash) const override {
return false;
}
std::unique_ptr<chrome::conflicts::BlocklistAction> IsBlocklisted(
std::unique_ptr<chrome::conflicts::BlacklistAction> IsBlacklisted(
const ModuleInfoKey& module_key,
const ModuleInfoData& module_data) const override {
return nullptr;
......@@ -404,9 +404,9 @@ TEST_F(IncompatibleApplicationsUpdaterTest, IgnoreNotLoadedModules) {
IncompatibleApplicationsUpdater::ModuleWarningDecision::kNotLoaded);
}
// Tests that modules with a matching certificate subject are allowlisted.
// Tests that modules with a matching certificate subject are whitelisted.
TEST_F(IncompatibleApplicationsUpdaterTest,
allowlistMatchingCertificateSubject) {
WhitelistMatchingCertificateSubject) {
if (base::win::GetVersion() < base::win::Version::WIN10)
return;
......@@ -475,11 +475,11 @@ TEST_F(IncompatibleApplicationsUpdaterTest, IgnoreRegisteredModules) {
IncompatibleApplicationsUpdater::ModuleWarningDecision::kAllowedIME);
}
TEST_F(IncompatibleApplicationsUpdaterTest, IgnoreModulesAddedToTheBlocklist) {
TEST_F(IncompatibleApplicationsUpdaterTest, IgnoreModulesAddedToTheBlacklist) {
if (base::win::GetVersion() < base::win::Version::WIN10)
return;
AddIncompatibleApplication(dll1_, L"Blocklisted Application",
AddIncompatibleApplication(dll1_, L"Blacklisted Application",
Option::ADD_REGISTRY_ENTRY);
auto incompatible_applications_updater =
......@@ -487,7 +487,7 @@ TEST_F(IncompatibleApplicationsUpdaterTest, IgnoreModulesAddedToTheBlocklist) {
// Set the respective bit for the module.
auto module_data = CreateLoadedModuleInfoData();
module_data.module_properties |= ModuleInfoData::kPropertyAddedToBlocklist;
module_data.module_properties |= ModuleInfoData::kPropertyAddedToBlacklist;
// Simulate the module loading into the process.
incompatible_applications_updater->OnNewModuleFound(
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_WIN_CONFLICTS_MODULE_BLOCKLIST_CACHE_UPDATER_H_
#define CHROME_BROWSER_WIN_CONFLICTS_MODULE_BLOCKLIST_CACHE_UPDATER_H_
#ifndef CHROME_BROWSER_WIN_CONFLICTS_MODULE_BLACKLIST_CACHE_UPDATER_H_
#define CHROME_BROWSER_WIN_CONFLICTS_MODULE_BLACKLIST_CACHE_UPDATER_H_
#include <vector>
......@@ -26,7 +26,7 @@ namespace base {
class SequencedTaskRunner;
}
// This class is responsible for maintaining the module blocklist cache, which
// This class is responsible for maintaining the module blacklist cache, which
// is used by chrome_elf.dll to determine which module to block from loading
// into the process.
//
......@@ -34,7 +34,7 @@ class SequencedTaskRunner;
// one module must be added to the cache.
//
//
// Additional implementation details about the module blocklist cache file:
// Additional implementation details about the module blacklist cache file:
//
// Because the file is written under the User Data directory, it is not possible
// for chrome_elf to find it by itself (see https://crbug.com/748949). So the
......@@ -42,7 +42,7 @@ class SequencedTaskRunner;
// making the already expanded path available.
//
// A consequence of this solution is that in some circumstances, multiple
// browser process will race to write the path to their blocklist file into a
// browser process will race to write the path to their blacklist file into a
// single registry key because the same registry key is shared between all User
// Data directories.
//
......@@ -53,8 +53,8 @@ class SequencedTaskRunner;
// This is acceptable given that all the caches contains more or less the same
// information and are interchangeable. Also, updates to the cache file and to
// the registry are atomic, guaranteeing that chrome_elf always reads a valid
// blocklist.
class ModuleBlocklistCacheUpdater : public ModuleDatabaseObserver {
// blacklist.
class ModuleBlacklistCacheUpdater : public ModuleDatabaseObserver {
public:
// A decision that explains whether or not a module is to be blocked. This
// decision is made with respect to the logic in the currently running
......@@ -110,7 +110,7 @@ class ModuleBlocklistCacheUpdater : public ModuleDatabaseObserver {
// startups.
// The module will be blocked because it is explicitly listed in the module
// blocklist.
// blacklist.
kDisallowedExplicit,
// The module will be implicitly blocked because it is not otherwise
// allowed.
......@@ -119,9 +119,9 @@ class ModuleBlocklistCacheUpdater : public ModuleDatabaseObserver {
};
struct ModuleBlockingState {
// Whether or not the module was in the blocklist cache that existed at
// Whether or not the module was in the blacklist cache that existed at
// startup.
bool was_in_blocklist_cache = false;
bool was_in_blacklist_cache = false;
// Whether or not the module was ever actively blocked from loading during
// this session.
......@@ -149,27 +149,27 @@ class ModuleBlocklistCacheUpdater : public ModuleDatabaseObserver {
// The parameters must outlive the lifetime of this class.
// The ModuleListFilter is taken by scoped_refptr since it will be used in a
// background sequence.
ModuleBlocklistCacheUpdater(
ModuleBlacklistCacheUpdater(
ModuleDatabaseEventSource* module_database_event_source,
const CertificateInfo& exe_certificate_info,
scoped_refptr<ModuleListFilter> module_list_filter,
const std::vector<third_party_dlls::PackedListModule>&
initial_blocklisted_modules,
initial_blacklisted_modules,
OnCacheUpdatedCallback on_cache_updated_callback,
bool module_analysis_disabled);
~ModuleBlocklistCacheUpdater() override;
~ModuleBlacklistCacheUpdater() override;
// Returns true if the blocking of third-party modules is enabled. Can be
// called on any thread. Notably does not check the ThirdPartyBlockingEnabled
// group policy.
static bool IsBlockingEnabled();
// Returns the path to the module blocklist cache.
static base::FilePath GetModuleBlocklistCachePath();
// Returns the path to the module blacklist cache.
static base::FilePath GetModuleBlacklistCachePath();
// Deletes the module blocklist cache. This disables the blocking of third-
// Deletes the module blacklist cache. This disables the blocking of third-
// party modules for the next browser launch.
static void DeleteModuleBlocklistCache();
static void DeleteModuleBlacklistCache();
// ModuleDatabaseObserver:
void OnNewModuleFound(const ModuleInfoKey& module_key,
......@@ -191,46 +191,46 @@ class ModuleBlocklistCacheUpdater : public ModuleDatabaseObserver {
enum class ModuleListState {
// The module is not in the module list at all.
kUnlisted,
// The module is in the module list and is explicitly allowlisted.
kAllowlisted,
// The module is in the module list and "blocklisted", but loading is
// The module is in the module list and is explicitly whitelisted.
kWhitelisted,
// The module is in the module list and "blacklisted", but loading is
// tolerated.
kTolerated,
// The module is explicitly blocklisted.
kBlocklisted,
// The module is explicitly blacklisted.
kBlacklisted,
};
// Gets the state of a module with respect to the module list.
ModuleListState DetermineModuleListState(const ModuleInfoKey& module_key,
const ModuleInfoData& module_data);
// Determines whether or not a module *should* be allowlisted or blocklisted
// Determines whether or not a module *should* be whitelisted or blacklisted
// on the next startup. Returns a ModuleBlockingDecision.
ModuleBlockingDecision DetermineModuleBlockingDecision(
const ModuleInfoKey& module_key,
const ModuleInfoData& module_data);
// Posts the task to update the cache on |background_sequence_|.
void StartModuleBlocklistCacheUpdate();
void StartModuleBlacklistCacheUpdate();
// Invoked on the sequence that owns this instance when the cache is updated.
void OnModuleBlocklistCacheUpdated(const CacheUpdateResult& result);
void OnModuleBlacklistCacheUpdated(const CacheUpdateResult& result);
ModuleDatabaseEventSource* const module_database_event_source_;
const CertificateInfo& exe_certificate_info_;
scoped_refptr<ModuleListFilter> module_list_filter_;
const std::vector<third_party_dlls::PackedListModule>&
initial_blocklisted_modules_;
initial_blacklisted_modules_;
OnCacheUpdatedCallback on_cache_updated_callback_;
// The sequence on which the module blocklist cache file is updated.
// The sequence on which the module blacklist cache file is updated.
scoped_refptr<base::SequencedTaskRunner> background_sequence_;
// Temporarily holds newly blocklisted modules before they are added to the
// module blocklist cache.
std::vector<third_party_dlls::PackedListModule> newly_blocklisted_modules_;
// Temporarily holds newly blacklisted modules before they are added to the
// module blacklist cache.
std::vector<third_party_dlls::PackedListModule> newly_blacklisted_modules_;
// Temporarily holds modules that were blocked from loading into the browser
// until they are used to update the cache.
......@@ -245,9 +245,9 @@ class ModuleBlocklistCacheUpdater : public ModuleDatabaseObserver {
SEQUENCE_CHECKER(sequence_checker_);
base::WeakPtrFactory<ModuleBlocklistCacheUpdater> weak_ptr_factory_;
base::WeakPtrFactory<ModuleBlacklistCacheUpdater> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(ModuleBlocklistCacheUpdater);
DISALLOW_COPY_AND_ASSIGN(ModuleBlacklistCacheUpdater);
};
#endif // CHROME_BROWSER_WIN_CONFLICTS_MODULE_BLOCKLIST_CACHE_UPDATER_H_
#endif // CHROME_BROWSER_WIN_CONFLICTS_MODULE_BLACKLIST_CACHE_UPDATER_H_
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_WIN_CONFLICTS_MODULE_BLOCKLIST_CACHE_UTIL_H_
#define CHROME_BROWSER_WIN_CONFLICTS_MODULE_BLOCKLIST_CACHE_UTIL_H_
#ifndef CHROME_BROWSER_WIN_CONFLICTS_MODULE_BLACKLIST_CACHE_UTIL_H_
#define CHROME_BROWSER_WIN_CONFLICTS_MODULE_BLACKLIST_CACHE_UTIL_H_
#include <stddef.h>
#include <stdint.h>
......@@ -28,12 +28,12 @@ class ModuleListFilter;
// of this component.
extern const base::FilePath::CharType kModuleListComponentRelativePath[];
// Returns the time date stamp to be used in the module blocklist cache.
// Returns the time date stamp to be used in the module blacklist cache.
// Represents the number of hours between |time| and the Windows epoch
// (1601-01-01 00:00:00 UTC).
uint32_t CalculateTimeDateStamp(base::Time time);
// The possible result value when trying to read an existing module blocklist
// The possible result value when trying to read an existing module blacklist
// cache. These values are persisted to logs. Entries should not be renumbered
// and numeric values should never be reused.
enum class ReadResult {
......@@ -56,53 +56,53 @@ enum class ReadResult {
kMaxValue = kFailInvalidMD5
};
// Reads an existing module blocklist cache at |module_blocklist_cache_path|
// into |metadata| and |blocklisted_modules| and return a ReadResult. Failures
// Reads an existing module blacklist cache at |module_blacklist_cache_path|
// into |metadata| and |blacklisted_modules| and return a ReadResult. Failures
// do not modify the out arguments.
ReadResult ReadModuleBlocklistCache(
const base::FilePath& module_blocklist_cache_path,
ReadResult ReadModuleBlacklistCache(
const base::FilePath& module_blacklist_cache_path,
third_party_dlls::PackedListMetadata* metadata,
std::vector<third_party_dlls::PackedListModule>* blocklisted_modules,
std::vector<third_party_dlls::PackedListModule>* blacklisted_modules,
base::MD5Digest* md5_digest);
// Writes |metadata| and |blocklisted_modules| to |module_blocklist_cache_path|
// to create a new module blocklist cache file. The MD5 digest of the cache is
// Writes |metadata| and |blacklisted_modules| to |module_blacklist_cache_path|
// to create a new module blacklist cache file. The MD5 digest of the cache is
// calculated and is returned via the out parameter |md5_digest|. Returns false
// on failure.
//
// Note: |blocklisted_modules| entries must be sorted by their |basename_hash|
// Note: |blacklisted_modules| entries must be sorted by their |basename_hash|
// and their |code_id_hash|, in that order.
bool WriteModuleBlocklistCache(
const base::FilePath& module_blocklist_cache_path,
bool WriteModuleBlacklistCache(
const base::FilePath& module_blacklist_cache_path,
const third_party_dlls::PackedListMetadata& metadata,
const std::vector<third_party_dlls::PackedListModule>& blocklisted_modules,
const std::vector<third_party_dlls::PackedListModule>& blacklisted_modules,
base::MD5Digest* md5_digest);
// Updates an existing list of |blocklisted_modules|. In particular:
// 1. allowlisted modules are removed.
// Uses |module_list_filter| to determine if a module is allowlisted.
// Updates an existing list of |blacklisted_modules|. In particular:
// 1. Whitelisted modules are removed.
// Uses |module_list_filter| to determine if a module is whitelisted.
// 2. Removes expired entries.
// Uses |max_module_count| and |min_time_date_stamp| to determine which
// entries should be removed. This step also ensures that enough of the
// oldest entries are removed to make room for the new modules.
// 3. Updates the |time_date_stamp| of blocklisted modules that attempted to
// 3. Updates the |time_date_stamp| of blacklisted modules that attempted to
// load and were blocked (passed via |blocked_modules|).
// 4. Adds newly blocklisted modules (passed via |newly_blocklisted_modules|).
// 4. Adds newly blacklisted modules (passed via |newly_blacklisted_modules|).
// 5. Sorts the final list by the |basename_hash| and the |code_id_hash| of
// each entry.
void UpdateModuleBlocklistCacheData(
void UpdateModuleBlacklistCacheData(
const ModuleListFilter& module_list_filter,
const std::vector<third_party_dlls::PackedListModule>&
newly_blocklisted_modules,
newly_blacklisted_modules,
const std::vector<third_party_dlls::PackedListModule>& blocked_modules,
size_t max_module_count,
uint32_t min_time_date_stamp,
third_party_dlls::PackedListMetadata* metadata,
std::vector<third_party_dlls::PackedListModule>* blocklisted_modules);
std::vector<third_party_dlls::PackedListModule>* blacklisted_modules);
namespace internal {
// Returns the expected file size of the Module Blocklist Cache for the given
// Returns the expected file size of the Module Blacklist Cache for the given
// |packed_list_metadata|.
int64_t CalculateExpectedFileSize(
third_party_dlls::PackedListMetadata packed_list_metadata);
......@@ -128,36 +128,36 @@ struct ModuleTimeDateStampGreater {
const third_party_dlls::PackedListModule& rhs) const;
};
// Removes all the entries in |blocklisted_modules| that are allowlisted by the
// Removes all the entries in |blacklisted_modules| that are whitelisted by the
// ModuleList component.
void RemoveAllowlistedEntries(
void RemoveWhitelistedEntries(
const ModuleListFilter& module_list_filter,
std::vector<third_party_dlls::PackedListModule>* blocklisted_modules);
std::vector<third_party_dlls::PackedListModule>* blacklisted_modules);
// Updates the |time_date_stamp| of each entry in |blocklisted_modules| that
// Updates the |time_date_stamp| of each entry in |blacklisted_modules| that
// also exists in |updated_modules|.
// Precondition: |blocklisted_modules| must be sorted by |basename_hash|, and
// Precondition: |blacklisted_modules| must be sorted by |basename_hash|, and
// then by |code_id_hash|.
void UpdateModuleBlocklistCacheTimestamps(
void UpdateModuleBlacklistCacheTimestamps(
const std::vector<third_party_dlls::PackedListModule>& updated_modules,
std::vector<third_party_dlls::PackedListModule>* blocklisted_modules);
std::vector<third_party_dlls::PackedListModule>* blacklisted_modules);
// Removes enough elements from the list of modules to ensure that adding all
// the newly blocklisted modules will fit inside the vector without busting the
// the newly blacklisted modules will fit inside the vector without busting the
// maximum size allowed.
// Note: |blocklisted_modules| must be sorted by |time_date_stamp| in descending
// Note: |blacklisted_modules| must be sorted by |time_date_stamp| in descending
// order (use ModuleTimeDateStampGreater).
void RemoveExpiredEntries(
uint32_t min_time_date_stamp,
size_t max_module_blocklist_cache_size,
size_t newly_blocklisted_modules_count,
std::vector<third_party_dlls::PackedListModule>* blocklisted_modules);
size_t max_module_blacklist_cache_size,
size_t newly_blacklisted_modules_count,
std::vector<third_party_dlls::PackedListModule>* blacklisted_modules);
// Removes duplicates entries in |blocklisted_modules|. Keeps the first
// Removes duplicates entries in |blacklisted_modules|. Keeps the first
// duplicate of each unique entry.
void RemoveDuplicateEntries(
std::vector<third_party_dlls::PackedListModule>* blocklisted_modules);
std::vector<third_party_dlls::PackedListModule>* blacklisted_modules);
} // namespace internal
#endif // CHROME_BROWSER_WIN_CONFLICTS_MODULE_BLOCKLIST_CACHE_UTIL_H_
#endif // CHROME_BROWSER_WIN_CONFLICTS_MODULE_BLACKLIST_CACHE_UTIL_H_
......@@ -197,7 +197,7 @@ void ModuleDatabase::OnModuleLoad(content::ProcessType process_type,
DCHECK(process_type == content::PROCESS_TYPE_BROWSER ||
process_type == content::PROCESS_TYPE_RENDERER)
<< "The current logic in ModuleBlocklistCacheUpdater does not support "
<< "The current logic in ModuleBlacklistCacheUpdater does not support "
"other process types yet. See https://crbug.com/662084 for details.";
ModuleInfo* module_info = nullptr;
......@@ -256,7 +256,7 @@ void ModuleDatabase::OnModuleBlocked(const base::FilePath& module_path,
module_info->second.module_properties |= ModuleInfoData::kPropertyBlocked;
}
void ModuleDatabase::OnModuleAddedToBlocklist(const base::FilePath& module_path,
void ModuleDatabase::OnModuleAddedToBlacklist(const base::FilePath& module_path,
uint32_t module_size,
uint32_t module_time_date_stamp) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
......@@ -264,10 +264,10 @@ void ModuleDatabase::OnModuleAddedToBlocklist(const base::FilePath& module_path,
auto iter = modules_.find(
ModuleInfoKey(module_path, module_size, module_time_date_stamp));
// Only known modules should be added to the blocklist.
// Only known modules should be added to the blacklist.
DCHECK(iter != modules_.end());
iter->second.module_properties |= ModuleInfoData::kPropertyAddedToBlocklist;
iter->second.module_properties |= ModuleInfoData::kPropertyAddedToBlacklist;
}
void ModuleDatabase::AddObserver(ModuleDatabaseObserver* observer) {
......@@ -426,7 +426,7 @@ void ModuleDatabase::MaybeInitializeThirdPartyConflictsManager(
return;
if (IncompatibleApplicationsUpdater::IsWarningEnabled() ||
ModuleBlocklistCacheUpdater::IsBlockingEnabled()) {
ModuleBlacklistCacheUpdater::IsBlockingEnabled()) {
DCHECK(base::FeatureList::IsEnabled(quarantine::kOutOfProcessQuarantine));
third_party_conflicts_manager_ =
......
......@@ -122,9 +122,9 @@ class ModuleDatabase : public ModuleDatabaseEventSource {
uint32_t module_size,
uint32_t module_time_date_stamp);
// Marks the module as added to the module blocklist cache, which means it
// Marks the module as added to the module blacklist cache, which means it
// will be blocked on the next browser launch.
void OnModuleAddedToBlocklist(const base::FilePath& module_path,
void OnModuleAddedToBlacklist(const base::FilePath& module_path,
uint32_t module_size,
uint32_t module_time_date_stamp);
......
......@@ -88,8 +88,8 @@ struct ModuleInfoData {
kPropertyShellExtension = 1 << 1,
// These modules are registered as an Input Method Editor.
kPropertyIme = 1 << 2,
// The module was added to the module blocklist cache.
kPropertyAddedToBlocklist = 1 << 3,
// The module was added to the module blacklist cache.
kPropertyAddedToBlacklist = 1 << 3,
// These modules were blocked from loading into the process.
kPropertyBlocked = 1 << 4,
};
......
......@@ -59,12 +59,12 @@ bool ModuleListFilter::Initialize(const base::FilePath& module_list_path) {
return initialized_;
}
bool ModuleListFilter::IsAllowlisted(
bool ModuleListFilter::IsWhitelisted(
base::StringPiece module_basename_hash,
base::StringPiece module_code_id_hash) const {
DCHECK(initialized_);
for (const auto& module_group : module_list_.allowlist().module_groups()) {
for (const auto& module_group : module_list_.whitelist().module_groups()) {
if (MatchesModuleGroup(module_group, module_basename_hash,
module_code_id_hash)) {
return true;
......@@ -74,7 +74,7 @@ bool ModuleListFilter::IsAllowlisted(
return false;
}
bool ModuleListFilter::IsAllowlisted(const ModuleInfoKey& module_key,
bool ModuleListFilter::IsWhitelisted(const ModuleInfoKey& module_key,
const ModuleInfoData& module_data) const {
// Precompute the hash of the basename and of the code id.
const std::string module_basename_hash =
......@@ -83,11 +83,11 @@ bool ModuleListFilter::IsAllowlisted(const ModuleInfoKey& module_key,
const std::string module_code_id_hash =
base::SHA1HashString(GenerateCodeId(module_key));
return IsAllowlisted(module_basename_hash, module_code_id_hash);
return IsWhitelisted(module_basename_hash, module_code_id_hash);
}
std::unique_ptr<chrome::conflicts::BlocklistAction>
ModuleListFilter::IsBlocklisted(const ModuleInfoKey& module_key,
std::unique_ptr<chrome::conflicts::BlacklistAction>
ModuleListFilter::IsBlacklisted(const ModuleInfoKey& module_key,
const ModuleInfoData& module_data) const {
DCHECK(initialized_);
......@@ -98,12 +98,12 @@ ModuleListFilter::IsBlocklisted(const ModuleInfoKey& module_key,
const std::string module_code_id_hash =
base::SHA1HashString(GenerateCodeId(module_key));
for (const auto& blocklist_module_group :
module_list_.blocklist().module_groups()) {
if (MatchesModuleGroup(blocklist_module_group.modules(),
for (const auto& blacklist_module_group :
module_list_.blacklist().module_groups()) {
if (MatchesModuleGroup(blacklist_module_group.modules(),
module_basename_hash, module_code_id_hash)) {
return std::make_unique<chrome::conflicts::BlocklistAction>(
blocklist_module_group.action());
return std::make_unique<chrome::conflicts::BlacklistAction>(
blacklist_module_group.action());
}
}
......
......@@ -19,41 +19,41 @@ namespace base {
class FilePath;
}
// This class is used to determine if a module should be blocklisted or
// allowlisted depending on the ModuleList component (See module_list.proto).
// This class is used to determine if a module should be blacklisted or
// whitelisted depending on the ModuleList component (See module_list.proto).
class ModuleListFilter : public base::RefCountedThreadSafe<ModuleListFilter> {
public:
ModuleListFilter();
bool Initialize(const base::FilePath& module_list_path);
// Returns true if a module is allowlisted based on the hash of its basename
// Returns true if a module is whitelisted based on the hash of its basename
// and code id.
//
// An allowlisted module should not trigger any warning to the user, nor
// A whitelisted module should not trigger any warning to the user, nor
// should it be blocked from loading into the process.
//
// Marked virtual to allow mocking.
virtual bool IsAllowlisted(base::StringPiece module_basename_hash,
virtual bool IsWhitelisted(base::StringPiece module_basename_hash,
base::StringPiece module_code_id_hash) const;
// Returns true if the module is allowlisted.
// Returns true if the module is whitelisted.
//
// This is a convenience wrapper for IsAllowlisted() that accepts a pair of
// This is a convenience wrapper for IsWhitelisted() that accepts a pair of
// ModuleInfoKey and ModuleInfoData.
bool IsAllowlisted(const ModuleInfoKey& module_key,
bool IsWhitelisted(const ModuleInfoKey& module_key,
const ModuleInfoData& module_data) const;
// Returns the BlocklistAction associated with a blocklisted module. Returns
// null if the module is not blocklisted.
// Returns the BlacklistAction associated with a blacklisted module. Returns
// null if the module is not blacklisted.
//
// A blocklisted module can cause instability if allowed into the process.
// A blacklisted module can cause instability if allowed into the process.
//
// The BlocklistAction indicates if the module should be allowed to load, and
// The BlacklistAction indicates if the module should be allowed to load, and
// which kind of message should be displayed to the user, if applicable.
//
// Marked virtual to allow mocking.
virtual std::unique_ptr<chrome::conflicts::BlocklistAction> IsBlocklisted(
virtual std::unique_ptr<chrome::conflicts::BlacklistAction> IsBlacklisted(
const ModuleInfoKey& module_key,
const ModuleInfoData& module_data) const;
......
......@@ -42,18 +42,18 @@ class ModuleListBuilder {
public:
explicit ModuleListBuilder(const base::FilePath& module_list_path)
: module_list_path_(module_list_path) {
// Include an empty blocklist and allowlist.
module_list_.mutable_blocklist();
module_list_.mutable_allowlist();
// Include an empty blacklist and whitelist.
module_list_.mutable_blacklist();
module_list_.mutable_whitelist();
}
// Adds a module to the allowlist.
void AddAllowlistedModule(base::Optional<base::string16> basename,
// Adds a module to the whitelist.
void AddWhitelistedModule(base::Optional<base::string16> basename,
base::Optional<std::string> code_id) {
CHECK(basename.has_value() || code_id.has_value());
chrome::conflicts::ModuleGroup* module_group =
module_list_.mutable_allowlist()->add_module_groups();
module_list_.mutable_whitelist()->add_module_groups();
chrome::conflicts::Module* module = module_group->add_modules();
......@@ -66,30 +66,30 @@ class ModuleListBuilder {
module->set_code_id_hash(base::SHA1HashString(code_id.value()));
}
// Adds a module to the allowlist. Used when both the Code ID and the basename
// Adds a module to the whitelist. Used when both the Code ID and the basename
// must be set.
void AddAllowlistedModule(const ModuleInfoKey& module_key,
void AddWhitelistedModule(const ModuleInfoKey& module_key,
const ModuleInfoData& module_data) {
AddAllowlistedModule(
AddWhitelistedModule(
module_data.inspection_result->basename,
GetCodeId(module_key.module_time_date_stamp, module_key.module_size));
}
// Adds a module to the blocklist.
void AddBlocklistedModule(
// Adds a module to the blacklist.
void AddBlacklistedModule(
const ModuleInfoKey& module_key,
const ModuleInfoData& module_data,
bool allow_load_value,
chrome::conflicts::BlocklistMessageType message_type,
chrome::conflicts::BlacklistMessageType message_type,
const std::string& message_url) {
chrome::conflicts::BlocklistModuleGroup* module_group =
module_list_.mutable_blocklist()->add_module_groups();
chrome::conflicts::BlacklistModuleGroup* module_group =
module_list_.mutable_blacklist()->add_module_groups();
chrome::conflicts::BlocklistAction* blocklist_action =
chrome::conflicts::BlacklistAction* blacklist_action =
module_group->mutable_action();
blocklist_action->set_allow_load(true);
blocklist_action->set_message_type(message_type);
blocklist_action->set_message_url(message_url);
blacklist_action->set_allow_load(true);
blacklist_action->set_message_type(message_type);
blacklist_action->set_message_url(message_url);
chrome::conflicts::Module* module =
module_group->mutable_modules()->add_modules();
......@@ -118,7 +118,7 @@ class ModuleListBuilder {
};
// Creates a pair of ModuleInfoKey and ModuleInfoData with the necessary
// information to call in IsModuleAllowlisted().
// information to call in IsModuleWhitelisted().
ModuleInfo CreateModuleInfo(const base::FilePath& module_path,
uint32_t module_size,
uint32_t module_time_date_stamp) {
......@@ -169,12 +169,12 @@ class ModuleListFilterTest : public ::testing::Test {
DISALLOW_COPY_AND_ASSIGN(ModuleListFilterTest);
};
TEST_F(ModuleListFilterTest, IsAllowlistedStringPieceVersion) {
TEST_F(ModuleListFilterTest, IsWhitelistedStringPieceVersion) {
base::string16 basename = L"basename.dll"; // Must be lowercase.
std::string code_id = GetCodeId(12u, 32u);
ModuleListBuilder module_list_builder(module_list_path());
module_list_builder.AddAllowlistedModule(basename, code_id);
module_list_builder.AddWhitelistedModule(basename, code_id);
ASSERT_TRUE(module_list_builder.Finalize());
ASSERT_TRUE(module_list_filter().Initialize(module_list_path()));
......@@ -183,49 +183,49 @@ TEST_F(ModuleListFilterTest, IsAllowlistedStringPieceVersion) {
std::string basename_hash = base::SHA1HashString(base::UTF16ToUTF8(basename));
std::string code_id_hash = base::SHA1HashString(code_id);
EXPECT_TRUE(module_list_filter().IsAllowlisted(basename_hash, code_id_hash));
EXPECT_TRUE(module_list_filter().IsWhitelisted(basename_hash, code_id_hash));
}
TEST_F(ModuleListFilterTest, AllowlistedModules) {
TEST_F(ModuleListFilterTest, WhitelistedModules) {
ModuleInfo module_1 = CreateModuleInfo(dll1_, 0123, 4567);
ModuleInfo module_2 = CreateModuleInfo(dll2_, 7654, 3210);
ModuleListBuilder module_list_builder(module_list_path());
module_list_builder.AddAllowlistedModule(module_1.first, module_1.second);
module_list_builder.AddWhitelistedModule(module_1.first, module_1.second);
ASSERT_TRUE(module_list_builder.Finalize());
ASSERT_TRUE(module_list_filter().Initialize(module_list_path()));
EXPECT_TRUE(
module_list_filter().IsAllowlisted(module_1.first, module_1.second));
module_list_filter().IsWhitelisted(module_1.first, module_1.second));
EXPECT_FALSE(
module_list_filter().IsAllowlisted(module_2.first, module_2.second));
module_list_filter().IsWhitelisted(module_2.first, module_2.second));
}
TEST_F(ModuleListFilterTest, BlocklistedModules) {
TEST_F(ModuleListFilterTest, BlacklistedModules) {
const char kFurtherInfoURL[] = "http://www.further-info.com";
ModuleInfo module_1 = CreateModuleInfo(dll1_, 0123, 4567);
ModuleInfo module_2 = CreateModuleInfo(dll2_, 7654, 3210);
ModuleListBuilder module_list_builder(module_list_path());
module_list_builder.AddBlocklistedModule(
module_list_builder.AddBlacklistedModule(
module_1.first, module_1.second, true,
chrome::conflicts::BlocklistMessageType::FURTHER_INFORMATION,
chrome::conflicts::BlacklistMessageType::FURTHER_INFORMATION,
kFurtherInfoURL);
ASSERT_TRUE(module_list_builder.Finalize());
ASSERT_TRUE(module_list_filter().Initialize(module_list_path()));
std::unique_ptr<chrome::conflicts::BlocklistAction> blocklist_action =
module_list_filter().IsBlocklisted(module_1.first, module_1.second);
ASSERT_TRUE(blocklist_action);
EXPECT_TRUE(blocklist_action->allow_load());
EXPECT_EQ(chrome::conflicts::BlocklistMessageType::FURTHER_INFORMATION,
blocklist_action->message_type());
EXPECT_EQ(kFurtherInfoURL, blocklist_action->message_url());
std::unique_ptr<chrome::conflicts::BlacklistAction> blacklist_action =
module_list_filter().IsBlacklisted(module_1.first, module_1.second);
ASSERT_TRUE(blacklist_action);
EXPECT_TRUE(blacklist_action->allow_load());
EXPECT_EQ(chrome::conflicts::BlacklistMessageType::FURTHER_INFORMATION,
blacklist_action->message_type());
EXPECT_EQ(kFurtherInfoURL, blacklist_action->message_url());
EXPECT_FALSE(
module_list_filter().IsBlocklisted(module_2.first, module_2.second));
module_list_filter().IsBlacklisted(module_2.first, module_2.second));
}
TEST_F(ModuleListFilterTest, BasenameOnly) {
......@@ -239,19 +239,19 @@ TEST_F(ModuleListFilterTest, BasenameOnly) {
base::FilePath(L"c:\\wrong_path\\wrong_basename.dll"), 1111, 0001);
ModuleListBuilder module_list_builder(module_list_path());
module_list_builder.AddAllowlistedModule(
module_list_builder.AddWhitelistedModule(
original.second.inspection_result->basename, base::nullopt);
ASSERT_TRUE(module_list_builder.Finalize());
ASSERT_TRUE(module_list_filter().Initialize(module_list_path()));
EXPECT_TRUE(
module_list_filter().IsAllowlisted(original.first, original.second));
EXPECT_TRUE(module_list_filter().IsAllowlisted(same_basename.first,
module_list_filter().IsWhitelisted(original.first, original.second));
EXPECT_TRUE(module_list_filter().IsWhitelisted(same_basename.first,
same_basename.second));
EXPECT_FALSE(
module_list_filter().IsAllowlisted(same_path.first, same_path.second));
EXPECT_FALSE(module_list_filter().IsAllowlisted(same_code_id.first,
module_list_filter().IsWhitelisted(same_path.first, same_path.second));
EXPECT_FALSE(module_list_filter().IsWhitelisted(same_code_id.first,
same_code_id.second));
}
......@@ -264,7 +264,7 @@ TEST_F(ModuleListFilterTest, CodeIdOnly) {
base::FilePath(L"c:\\wrong_path\\wrong_basename.dll"), 1111, 0001);
ModuleListBuilder module_list_builder(module_list_path());
module_list_builder.AddAllowlistedModule(
module_list_builder.AddWhitelistedModule(
base::nullopt, GetCodeId(original.first.module_time_date_stamp,
original.first.module_size));
ASSERT_TRUE(module_list_builder.Finalize());
......@@ -272,9 +272,9 @@ TEST_F(ModuleListFilterTest, CodeIdOnly) {
ASSERT_TRUE(module_list_filter().Initialize(module_list_path()));
EXPECT_TRUE(
module_list_filter().IsAllowlisted(original.first, original.second));
EXPECT_FALSE(module_list_filter().IsAllowlisted(same_basename.first,
module_list_filter().IsWhitelisted(original.first, original.second));
EXPECT_FALSE(module_list_filter().IsWhitelisted(same_basename.first,
same_basename.second));
EXPECT_TRUE(module_list_filter().IsAllowlisted(same_code_id.first,
EXPECT_TRUE(module_list_filter().IsWhitelisted(same_code_id.first,
same_code_id.second));
}
......@@ -17,7 +17,7 @@
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "base/task_runner_util.h"
#include "chrome/browser/win/conflicts/module_blocklist_cache_util.h"
#include "chrome/browser/win/conflicts/module_blacklist_cache_util.h"
#include "chrome/chrome_elf/third_party_dlls/public_api.h"
namespace {
......
......@@ -52,78 +52,78 @@ message ModuleGroup {
repeated Module modules = 3;
}
// Describes an allowlist of modules that will always be allowed to load, and
// for which there is no associated user messaging.
// Describes a whitelist of modules that will always be allowed to load, and for
// which there is no associated user messaging.
// Next id: 2
message ModuleAllowlist {
message ModuleWhitelist {
// A collection of modules, grouped by publisher/installation path
// information.
repeated ModuleGroup module_groups = 1;
}
// The user message to display when a blocklisted module is matched at runtime.
// The user message to display when a blacklisted module is matched at runtime.
// Next id: 3
enum BlocklistMessageType {
enum BlacklistMessageType {
// The user will be presented with a message to uninstall the software. This
// message will only be displayed if a matching software entry with
// uninstallation registry entries can be found. This is the default action
// that is applied to all modules that are not specifically allowlisted.
// It's presence in this list allows a module to remain blocklisted, but be
// that is applied to all modules that are not specifically whitelisted.
// It's presence in this list allows a module to remain blacklisted, but be
// allowed to load. If this is specified then |message_url| should be empty
// and is otherwise ignored.
UNINSTALL = 0;
// The user will be presented with a message about the incompatibility of
// the related software, and provided with a link to follow for further
// information. The URL is specified via |message_url| in an associated
// BlocklistAction.
// BlacklistAction.
FURTHER_INFORMATION = 1;
// The user will be presented with a message about the incompatiblity of
// the related software, and provided with a link to follow in order to
// upgrade the software to a compatible version. The URL is specified via
// |message_url| in an associated BlocklistAction.
// |message_url| in an associated BlacklistAction.
SUGGEST_UPGRADE = 2;
};
// The actions to take when a blocklisted module is encountered.
// The actions to take when a blacklisted module is encountered.
// Next id: 4
message BlocklistAction {
message BlacklistAction {
// Indicates whether or not this module should be allowed to load. This can be
// used to explicitly allow modules to load that when blocked cause problems,
// but otherwise to allow messaging to encourage users to remove them.
optional bool allow_load = 1;
// The URL associated with the user message. See BlocklistMessageType for full
// The URL associated with the user message. See BlacklistMessageType for full
// details.
optional BlocklistMessageType message_type = 2;
optional BlacklistMessageType message_type = 2;
optional string message_url = 3;
}
// Describes a group in the module blocklist. Modules not allowlisted are
// blocklisted by default, but fine-grained control over the user messaging is
// possible using an explicit blocklist entry.
// Describes a group in the module blacklist. Modules not whitelisted are
// blacklisted by default, but fine-grained control over the user messaging is
// possible using an explicit blacklist entry.
// Next id: 3
message BlocklistModuleGroup {
message BlacklistModuleGroup {
// The action to take when modules in this group are encountered.
optional BlocklistAction action = 1;
optional BlacklistAction action = 1;
// The group of modules itself.
optional ModuleGroup modules = 2;
}
// Describes a blocklist of modules that are to be handled specially when
// Describes a blacklist of modules that are to be handled specially when
// encountered.
// Next id: 2
message ModuleBlocklist {
repeated BlocklistModuleGroup module_groups = 1;
message ModuleBlacklist {
repeated BlacklistModuleGroup module_groups = 1;
}
// The entire module list itself consists of an allowlist and a blocklist.
// The entire module list itself consists of a whitelist and a blacklist.
// Next id: 3
message ModuleList {
// The allowlisted modules.
optional ModuleAllowlist allowlist = 1;
// The whitelisted modules.
optional ModuleWhitelist whitelist = 1;
// The blocklisted modules, and the associated actions to take upon
// The blacklisted modules, and the associated actions to take upon
// encountering them.
optional ModuleBlocklist blocklist = 2;
optional ModuleBlacklist blacklist = 2;
}
......@@ -15,8 +15,8 @@
#include "base/test/test_reg_util_win.h"
#include "base/win/registry.h"
#include "base/win/windows_version.h"
#include "chrome/browser/win/conflicts/module_blocklist_cache_updater.h"
#include "chrome/browser/win/conflicts/module_blocklist_cache_util.h"
#include "chrome/browser/win/conflicts/module_blacklist_cache_updater.h"
#include "chrome/browser/win/conflicts/module_blacklist_cache_util.h"
#include "chrome/browser/win/conflicts/module_database.h"
#include "chrome/browser/win/conflicts/proto/module_list.pb.h"
#include "chrome/browser/win/conflicts/third_party_conflicts_manager.h"
......@@ -83,15 +83,15 @@ class ThirdPartyRegistryKeyObserver {
// directory and returns its path.
void CreateModuleList(base::FilePath* module_list_path) {
chrome::conflicts::ModuleList module_list;
// Include an empty blocklist and allowlist.
module_list.mutable_blocklist();
module_list.mutable_allowlist();
// Include an empty blacklist and whitelist.
module_list.mutable_blacklist();
module_list.mutable_whitelist();
std::string contents;
ASSERT_TRUE(module_list.SerializeToString(&contents));
// Put the module list beside the module blocklist cache.
*module_list_path = ModuleBlocklistCacheUpdater::GetModuleBlocklistCachePath()
// Put the module list beside the module blacklist cache.
*module_list_path = ModuleBlacklistCacheUpdater::GetModuleBlacklistCachePath()
.DirName()
.Append(FILE_PATH_LITERAL("ModuleList.bin"));
......@@ -123,7 +123,7 @@ class ThirdPartyBlockingBrowserTest : public InProcessBrowserTest {
// Creates a copy of a test DLL into a temp directory that will act as the
// third-party module and return its path. It can't be located in the output
// directory because modules in the same directory as chrome.exe are
// allowlisted in non-official builds.
// whitelisted in non-official builds.
void CreateThirdPartyModule(base::FilePath* third_party_module_path) {
base::FilePath test_dll_path;
ASSERT_TRUE(base::PathService::Get(base::DIR_EXE, &test_dll_path));
......@@ -151,13 +151,13 @@ class ThirdPartyBlockingBrowserTest : public InProcessBrowserTest {
// This is an integration test for the blocking of third-party modules.
//
// This test makes sure that all the different classes interact together
// correctly to produce a valid module blocklist cache and to write its path in
// correctly to produce a valid module blacklist cache and to write its path in
// the registry.
//
// Note: This doesn't test that the modules are actually blocked on the next
// browser launch.
IN_PROC_BROWSER_TEST_F(ThirdPartyBlockingBrowserTest,
CreateModuleBlocklistCache) {
CreateModuleBlacklistCache) {
if (base::win::GetVersion() < base::win::Version::WIN8)
return;
......@@ -195,22 +195,22 @@ IN_PROC_BROWSER_TEST_F(ThirdPartyBlockingBrowserTest,
base::ScopedNativeLibrary dll(third_party_module_path);
ASSERT_TRUE(dll.is_valid());
// Now the module blocklist cache will eventually be created and its path
// Now the module blacklist cache will eventually be created and its path
// written in the registry.
third_party_registry_key_observer.WaitForCachePathWritten();
base::FilePath module_blocklist_cache_path =
ModuleBlocklistCacheUpdater::GetModuleBlocklistCachePath();
ASSERT_FALSE(module_blocklist_cache_path.empty());
ASSERT_TRUE(base::PathExists(module_blocklist_cache_path));
base::FilePath module_blacklist_cache_path =
ModuleBlacklistCacheUpdater::GetModuleBlacklistCachePath();
ASSERT_FALSE(module_blacklist_cache_path.empty());
ASSERT_TRUE(base::PathExists(module_blacklist_cache_path));
// Now check that the third-party DLL was added to the module blocklist cache.
// Now check that the third-party DLL was added to the module blacklist cache.
third_party_dlls::PackedListMetadata metadata;
std::vector<third_party_dlls::PackedListModule> blocklisted_modules;
std::vector<third_party_dlls::PackedListModule> blacklisted_modules;
base::MD5Digest md5_digest;
ASSERT_EQ(ReadResult::kSuccess,
ReadModuleBlocklistCache(module_blocklist_cache_path, &metadata,
&blocklisted_modules, &md5_digest));
ReadModuleBlacklistCache(module_blacklist_cache_path, &metadata,
&blacklisted_modules, &md5_digest));
EXPECT_GE(blocklisted_modules.size(), 1u);
EXPECT_GE(blacklisted_modules.size(), 1u);
}
......@@ -15,7 +15,7 @@
#include "base/memory/weak_ptr.h"
#include "base/optional.h"
#include "base/strings/string_piece_forward.h"
#include "chrome/browser/win/conflicts/module_blocklist_cache_updater.h"
#include "chrome/browser/win/conflicts/module_blacklist_cache_updater.h"
#include "chrome/browser/win/conflicts/module_database_observer.h"
#include "chrome/browser/win/conflicts/module_list_component_updater.h"
#include "chrome/chrome_elf/third_party_dlls/packed_list_format.h"
......@@ -37,7 +37,7 @@ class Version;
// IncompatibleApplicationsWarning and ThirdPartyModulesBlocking features. Each
// feature requires a set of dependencies to be initialized on a background
// sequence because their main class can be created
// (IncompatibleApplicationsUpdater and ModuleBlocklistCacheUpdater
// (IncompatibleApplicationsUpdater and ModuleBlacklistCacheUpdater
// respectively).
//
// Dependencies list
......@@ -54,8 +54,8 @@ class Version;
// installed on the computer.
//
// For the ThirdPartyModulesBlocking feature only:
// 4. |initial_blocklisted_modules_| contains the list of modules that were
// blocklisted at the time the browser was launched. Modifications to that
// 4. |initial_blacklisted_modules_| contains the list of modules that were
// blacklisted at the time the browser was launched. Modifications to that
// list do not take effect until a restart.
//
class ThirdPartyConflictsManager : public ModuleDatabaseObserver {
......@@ -70,7 +70,7 @@ class ThirdPartyConflictsManager : public ModuleDatabaseObserver {
// Explicitely disables the third-party module blocking feature. This is
// needed because simply turning off the feature using either the Feature List
// API or via group policy is not sufficient. Disabling the blocking requires
// the deletion of the module blocklist cache. This task is executed on
// the deletion of the module blacklist cache. This task is executed on
// |background_sequence|.
static void DisableThirdPartyModuleBlocking(
base::TaskRunner* background_sequence);
......@@ -97,7 +97,7 @@ class ThirdPartyConflictsManager : public ModuleDatabaseObserver {
void LoadModuleList(const base::FilePath& path);
// Force the initialization of the IncompatibleApplicationsUpdater and the
// ModuleBlocklistCacheUpdater instances by triggering an update of the module
// ModuleBlacklistCacheUpdater instances by triggering an update of the module
// list component, if needed. Immediately invokes
// |on_initialization_event_callback| if this instance is already in a final
// state (Failed to initialize or fully initialized). This is only meant to be
......@@ -130,10 +130,10 @@ class ThirdPartyConflictsManager : public ModuleDatabaseObserver {
return incompatible_applications_updater_.get();
}
// Returns the ModuleBlocklistCacheUpdater instance. Returns null if the
// Returns the ModuleBlacklistCacheUpdater instance. Returns null if the
// corresponding feature is disabled (ThirdPartyModulesBlocking).
ModuleBlocklistCacheUpdater* module_blocklist_cache_updater() {
return module_blocklist_cache_updater_.get();
ModuleBlacklistCacheUpdater* module_blacklist_cache_updater() {
return module_blacklist_cache_updater_.get();
}
// Disables the analysis of newly found modules.
......@@ -148,20 +148,20 @@ class ThirdPartyConflictsManager : public ModuleDatabaseObserver {
void OnInstalledApplicationsCreated(
std::unique_ptr<InstalledApplications> installed_applications);
// Called when |initial_blocklisted_modules_| finishes its initialization.
void OnInitialBlocklistedModulesRead(
// Called when |initial_blacklisted_modules_| finishes its initialization.
void OnInitialBlacklistedModulesRead(
std::unique_ptr<std::vector<third_party_dlls::PackedListModule>>
initial_blocklisted_modules);
initial_blacklisted_modules);
// Initializes either or both |incompatible_applications_updater_| and
// |module_blocklist_cache_updater_| when the exe_certificate_info_, the
// |module_blacklist_cache_updater_| when the exe_certificate_info_, the
// module_list_filter_ and the installed_applications_ are available.
void InitializeIfReady();
// Checks if the |old_md5_digest| matches the expected one from the Local
// State file, and updates it to |new_md5_digest|.
void OnModuleBlocklistCacheUpdated(
const ModuleBlocklistCacheUpdater::CacheUpdateResult& result);
void OnModuleBlacklistCacheUpdated(
const ModuleBlacklistCacheUpdater::CacheUpdateResult& result);
// Forcibly triggers an update of the Third Party Module List component. Only
// invoked when ForceInitialization() is called.
......@@ -209,22 +209,22 @@ class ThirdPartyConflictsManager : public ModuleDatabaseObserver {
// thread if none is currently installed.
ModuleListComponentUpdater::UniquePtr module_list_component_updater_;
// Filters third-party modules against an allowlist and a blocklist. This
// instance is ref counted because the |module_blocklist_cache_updater_| must
// Filters third-party modules against a whitelist and a blacklist. This
// instance is ref counted because the |module_blacklist_cache_updater_| must
// use it on a background sequence.
scoped_refptr<ModuleListFilter> module_list_filter_;
// The blocklisted modules contained in the cache used to initialize the
// The blacklisted modules contained in the cache used to initialize the
// blocking in chrome_elf.
std::unique_ptr<std::vector<third_party_dlls::PackedListModule>>
initial_blocklisted_modules_;
initial_blacklisted_modules_;
// Retrieves the list of installed applications.
std::unique_ptr<InstalledApplications> installed_applications_;
// Maintains the module blocklist cache. This member is only initialized when
// Maintains the module blacklist cache. This member is only initialized when
// the ThirdPartyModuleBlocking feature is enabled.
std::unique_ptr<ModuleBlocklistCacheUpdater> module_blocklist_cache_updater_;
std::unique_ptr<ModuleBlacklistCacheUpdater> module_blacklist_cache_updater_;
// Maintains the cache of incompatible applications. This member is only
// initialized when the IncompatibleApplicationsWarning feature is enabled.
......
......@@ -50,9 +50,9 @@ class ThirdPartyConflictsManagerTest : public testing::Test,
// Writes an empty serialized ModuleList proto to |GetModuleListPath()|.
void CreateModuleList() {
chrome::conflicts::ModuleList module_list;
// Include an empty blocklist and allowlist.
module_list.mutable_blocklist();
module_list.mutable_allowlist();
// Include an empty blacklist and whitelist.
module_list.mutable_blacklist();
module_list.mutable_whitelist();
std::string contents;
ASSERT_TRUE(module_list.SerializeToString(&contents));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment