Commit 1e51ea53 authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Revert "Don't warn about modules in the same directory as Chrome"

This reverts commit 12164db3.

Reason for revert: 
Compilation error below on official build.

Please remove |#if !defined(OFFICIAL_BUILD)| at L30.

30 #if !defined(OFFICIAL_BUILD)
31 #include "base/base_paths.h"
32 #include "base/path_service.h"
33 #endif

ompatible_applications_updater_win.cc /Foobj/chrome/browser/browser/incompatible_applications_updater_win.obj /Fd"obj/chrome/browser/browser_cc.pdb"
../../chrome/browser/conflicts/incompatible_applications_updater_win.cc(332,13):  error: no member named 'PathService' in namespace 'base'
  if (base::PathService::Get(base::DIR_EXE, &exe_path) &&
      ~~~~~~^
../../chrome/browser/conflicts/incompatible_applications_updater_win.cc(332,36):  error: no member named 'DIR_EXE' in namespace 'base'
  if (base::PathService::Get(base::DIR_EXE, &exe_path) &&
                             ~~~~~~^



Original change's description:
> Don't warn about modules in the same directory as Chrome
> 
> Bug: 876096
> Change-Id: I85a7d7d5529270a829d9849a8bb638d9d02b7813
> Reviewed-on: https://chromium-review.googlesource.com/1182341
> Commit-Queue: Patrick Monette <pmonette@chromium.org>
> Reviewed-by: Chris Hamilton <chrisha@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#584586}

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

Change-Id: Id5c5647be399362929de2a7773bd581dbbe41633
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 876096
Reviewed-on: https://chromium-review.googlesource.com/1182841Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584589}
parent f93f8b7c
...@@ -311,6 +311,18 @@ void IncompatibleApplicationsUpdater::OnNewModuleFound( ...@@ -311,6 +311,18 @@ void IncompatibleApplicationsUpdater::OnNewModuleFound(
return; return;
} }
// For developer builds only, whitelist modules in the same directory as the
// executable.
#if !defined(OFFICIAL_BUILD)
base::FilePath exe_path;
if (base::PathService::Get(base::DIR_EXE, &exe_path) &&
exe_path.DirName().IsParent(module_key.module_path)) {
module_warning_decisions_[module_key.module_id] =
ModuleWarningDecision::kAllowedSameDirectory;
return;
}
#endif
// Second, check if the module is seemingly signed by Microsoft. Again, no // Second, check if the module is seemingly signed by Microsoft. Again, no
// attempt is made to check the validity of the certificate. // attempt is made to check the validity of the certificate.
if (IsMicrosoftModule( if (IsMicrosoftModule(
...@@ -320,22 +332,6 @@ void IncompatibleApplicationsUpdater::OnNewModuleFound( ...@@ -320,22 +332,6 @@ void IncompatibleApplicationsUpdater::OnNewModuleFound(
return; return;
} }
// Whitelist modules in the same directory as the executable. This serves 2
// purposes:
// - 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. If an injected third-party DLL is first copied
// into Chrome's directory, Chrome will blame itself as an incompatible
// application.
base::FilePath exe_path;
if (base::PathService::Get(base::DIR_EXE, &exe_path) &&
exe_path.DirName().IsParent(module_key.module_path)) {
module_warning_decisions_[module_key.module_id] =
ModuleWarningDecision::kAllowedSameDirectory;
return;
}
// Skip modules whitelisted by the Module List component. // Skip modules whitelisted by the Module List component.
if (module_list_filter_->IsWhitelisted(module_key, module_data)) { if (module_list_filter_->IsWhitelisted(module_key, module_data)) {
module_warning_decisions_[module_key.module_id] = module_warning_decisions_[module_key.module_id] =
......
...@@ -47,7 +47,7 @@ class IncompatibleApplicationsUpdater : public ModuleDatabaseObserver { ...@@ -47,7 +47,7 @@ class IncompatibleApplicationsUpdater : public ModuleDatabaseObserver {
// validated. // validated.
kAllowedSameCertificate, kAllowedSameCertificate,
// Allowed because the path of the executable is the parent of the path of // Allowed because the path of the executable is the parent of the path of
// the module. // the module. Only used in non-official builds.
kAllowedSameDirectory, kAllowedSameDirectory,
// Allowed because it is signed by Microsoft. The certificate is not // Allowed because it is signed by Microsoft. The certificate is not
// validated. // validated.
......
...@@ -34,19 +34,10 @@ namespace { ...@@ -34,19 +34,10 @@ namespace {
constexpr char kNotLoaded[] = "Not loaded"; constexpr char kNotLoaded[] = "Not loaded";
constexpr char kAllowedInputMethodEditor[] = "Allowed - Input method editor"; constexpr char kAllowedInputMethodEditor[] = "Allowed - Input method editor";
constexpr char kAllowedMatchingCertificate[] = "Allowed - Matching certificate"; constexpr char kAllowedMatchingCertificate[] = "Allowed - Matching certificate";
constexpr char kAllowedMicrosoftModule[] = "Allowed - Microsoft module";
constexpr char kAllowedWhitelisted[] = "Allowed - Whitelisted";
constexpr char kAllowedSameDirectory[] = constexpr char kAllowedSameDirectory[] =
#if defined(OFFICIAL_BUILD)
// In official builds, modules in the Chrome directory are blocked but they
// won't cause a warning because the warning would blame Chrome itself.
"Tolerated - In executable directory";
#else // !defined(OFFICIAL_BUILD)
// In developer builds, DLLs that are part of Chrome are not signed and thus
// the easy way to identify them is to check that they are in the same
// directory (or child folder) as the main exe.
"Allowed - In executable directory (dev builds only)"; "Allowed - In executable directory (dev builds only)";
#endif constexpr char kAllowedMicrosoftModule[] = "Allowed - Microsoft module";
constexpr char kAllowedWhitelisted[] = "Allowed - Whitelisted";
void AppendString(base::StringPiece input, std::string* output) { void AppendString(base::StringPiece input, std::string* output) {
if (!output->empty()) if (!output->empty())
......
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