From: Michael Gilbert Date: Wed, 21 Nov 2018 02:37:35 +0000 Subject: Disable support for RAR files inspection License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- .../download_protection/file_analyzer.cc | 2 +- .../services/file_util/safe_archive_analyzer.cc | 15 ++------------- chrome/services/file_util/safe_archive_analyzer.h | 2 -- chrome/utility/safe_browsing/BUILD.gn | 2 -- chrome/utility/safe_browsing/archive_analyzer.cc | 2 +- 5 files changed, 4 insertions(+), 19 deletions(-) diff --git a/chrome/browser/safe_browsing/download_protection/file_analyzer.cc b/chrome/browser/safe_browsing/download_protection/file_analyzer.cc --- a/chrome/browser/safe_browsing/download_protection/file_analyzer.cc +++ b/chrome/browser/safe_browsing/download_protection/file_analyzer.cc @@ -78,7 +78,7 @@ void FileAnalyzer::Start(const base::FilePath& target_path, if (inspection_type == DownloadFileType::ZIP) { StartExtractZipFeatures(); } else if (inspection_type == DownloadFileType::RAR) { - StartExtractRarFeatures(); + LOG(WARNING) << "Safebrowser inspection of rar files is disabled in this build"; #if BUILDFLAG(IS_MAC) } else if (inspection_type == DownloadFileType::DMG) { StartExtractDmgFeatures(); diff --git a/chrome/services/file_util/safe_archive_analyzer.cc b/chrome/services/file_util/safe_archive_analyzer.cc --- a/chrome/services/file_util/safe_archive_analyzer.cc +++ b/chrome/services/file_util/safe_archive_analyzer.cc @@ -77,19 +77,8 @@ void SafeArchiveAnalyzer::AnalyzeRarFile( DCHECK(rar_file.IsValid()); temp_file_getter_.Bind(std::move(temp_file_getter)); callback_ = std::move(callback); - AnalysisFinishedCallback analysis_finished_callback = - base::BindOnce(&SafeArchiveAnalyzer::AnalysisFinished, - weak_factory_.GetWeakPtr(), base::FilePath()); - base::RepeatingCallback - temp_file_getter_callback = - base::BindRepeating(&SafeArchiveAnalyzer::RequestTemporaryFile, - weak_factory_.GetWeakPtr()); - timeout_timer_.Start(FROM_HERE, kArchiveAnalysisTimeout, this, - &SafeArchiveAnalyzer::Timeout); - rar_analyzer_.Analyze(std::move(rar_file), base::FilePath(), - /*password=*/password, - std::move(analysis_finished_callback), - std::move(temp_file_getter_callback), &results_); + LOG(FATAL) << "AnalyzeRarFile is disabled in this build"; + Timeout(); } void SafeArchiveAnalyzer::AnalyzeSevenZipFile( diff --git a/chrome/services/file_util/safe_archive_analyzer.h b/chrome/services/file_util/safe_archive_analyzer.h --- a/chrome/services/file_util/safe_archive_analyzer.h +++ b/chrome/services/file_util/safe_archive_analyzer.h @@ -7,7 +7,6 @@ #include "chrome/common/safe_browsing/archive_analyzer_results.h" #include "chrome/services/file_util/public/mojom/safe_archive_analyzer.mojom.h" -#include "chrome/utility/safe_browsing/rar_analyzer.h" #include "chrome/utility/safe_browsing/seven_zip_analyzer.h" #include "chrome/utility/safe_browsing/zip_analyzer.h" #include "mojo/public/cpp/bindings/remote.h" @@ -66,7 +65,6 @@ class SafeArchiveAnalyzer : public chrome::mojom::SafeArchiveAnalyzer { void Timeout(); safe_browsing::ZipAnalyzer zip_analyzer_; - safe_browsing::RarAnalyzer rar_analyzer_; safe_browsing::SevenZipAnalyzer seven_zip_analyzer_; #if BUILDFLAG(IS_MAC) safe_browsing::dmg::DMGAnalyzer dmg_analyzer_; diff --git a/chrome/utility/safe_browsing/BUILD.gn b/chrome/utility/safe_browsing/BUILD.gn --- a/chrome/utility/safe_browsing/BUILD.gn +++ b/chrome/utility/safe_browsing/BUILD.gn @@ -31,8 +31,6 @@ source_set("safe_browsing") { sources = [ "archive_analyzer.cc", "archive_analyzer.h", - "rar_analyzer.cc", - "rar_analyzer.h", "seven_zip_analyzer.cc", "seven_zip_analyzer.h", "zip_analyzer.cc", diff --git a/chrome/utility/safe_browsing/archive_analyzer.cc b/chrome/utility/safe_browsing/archive_analyzer.cc --- a/chrome/utility/safe_browsing/archive_analyzer.cc +++ b/chrome/utility/safe_browsing/archive_analyzer.cc @@ -24,7 +24,7 @@ namespace safe_browsing { std::unique_ptr ArchiveAnalyzer::CreateForArchiveType( DownloadFileType_InspectionType file_type) { if (file_type == DownloadFileType::RAR) { - return std::make_unique(); + return nullptr; } else if (file_type == DownloadFileType::ZIP) { return std::make_unique(); } else if (file_type == DownloadFileType::SEVEN_ZIP) { -- 2.25.1