Files
cromite/build/patches/Disable-support-for-RAR-files-inspection.patch
T

123 lines
5.7 KiB
Diff

From: Michael Gilbert <mgilbert@debian.org>
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 +-
chrome/common/safe_browsing/BUILD.gn | 2 --
chrome/common/safe_browsing/zip_analyzer.cc | 7 -------
chrome/common/safe_browsing/zip_analyzer.h | 2 --
.../services/file_util/safe_archive_analyzer.cc | 17 +++--------------
.../services/file_util/safe_archive_analyzer.h | 2 --
6 files changed, 4 insertions(+), 28 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/common/safe_browsing/BUILD.gn b/chrome/common/safe_browsing/BUILD.gn
--- a/chrome/common/safe_browsing/BUILD.gn
+++ b/chrome/common/safe_browsing/BUILD.gn
@@ -143,8 +143,6 @@ source_set("safe_browsing") {
"protobuf_message_log_macros.h",
"protobuf_message_read_macros.h",
"protobuf_message_write_macros.h",
- "rar_analyzer.cc",
- "rar_analyzer.h",
"seven_zip_analyzer.cc",
"seven_zip_analyzer.h",
"zip_analyzer.cc",
diff --git a/chrome/common/safe_browsing/zip_analyzer.cc b/chrome/common/safe_browsing/zip_analyzer.cc
--- a/chrome/common/safe_browsing/zip_analyzer.cc
+++ b/chrome/common/safe_browsing/zip_analyzer.cc
@@ -132,13 +132,6 @@ bool ZipAnalyzer::AnalyzeNestedArchive(
std::move(nested_analysis_finished_callback),
get_temp_file_callback_, results_);
return true;
- } else if (file_type == DownloadFileType::RAR) {
- nested_rar_analyzer_ = std::make_unique<safe_browsing::RarAnalyzer>();
- nested_rar_analyzer_->Init(temp_file_.Duplicate(),
- root_zip_path_.Append(path),
- std::move(nested_analysis_finished_callback),
- get_temp_file_callback_, results_);
- return true;
}
return false;
}
diff --git a/chrome/common/safe_browsing/zip_analyzer.h b/chrome/common/safe_browsing/zip_analyzer.h
--- a/chrome/common/safe_browsing/zip_analyzer.h
+++ b/chrome/common/safe_browsing/zip_analyzer.h
@@ -14,7 +14,6 @@
#include "third_party/zlib/google/zip_reader.h"
namespace safe_browsing {
-class RarAnalyzer;
struct ArchiveAnalyzerResults;
using FinishedAnalysisCallback = base::OnceCallback<void()>;
@@ -78,7 +77,6 @@ class ZipAnalyzer {
// DFS.
// TODO(crbug.com/1426164) Create a common class to hold all analyzers.
std::unique_ptr<safe_browsing::ZipAnalyzer> nested_zip_analyzer_;
- std::unique_ptr<safe_browsing::RarAnalyzer> nested_rar_analyzer_;
base::WeakPtrFactory<ZipAnalyzer> weak_factory_{this};
};
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
@@ -62,20 +62,9 @@ void SafeArchiveAnalyzer::AnalyzeRarFile(
mojo::PendingRemote<chrome::mojom::TemporaryFileGetter> temp_file_getter,
AnalyzeRarFileCallback callback) {
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<void(GetTempFileCallback callback)>
- temp_file_getter_callback =
- base::BindRepeating(&SafeArchiveAnalyzer::RequestTemporaryFile,
- weak_factory_.GetWeakPtr());
- timeout_timer_.Start(FROM_HERE, kArchiveAnalysisTimeout, this,
- &SafeArchiveAnalyzer::Timeout);
- rar_analyzer_.Init(std::move(rar_file), base::FilePath(),
- std::move(analysis_finished_callback),
- std::move(temp_file_getter_callback), &results_);
+ LOG(FATAL) << "AnalyzeRarFile is disabled in this build";
+ safe_browsing::ArchiveAnalyzerResults results;
+ std::move(callback).Run(results);
}
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
@@ -6,7 +6,6 @@
#define CHROME_SERVICES_FILE_UTIL_SAFE_ARCHIVE_ANALYZER_H_
#include "chrome/common/safe_browsing/archive_analyzer_results.h"
-#include "chrome/common/safe_browsing/rar_analyzer.h"
#include "chrome/services/file_util/public/mojom/safe_archive_analyzer.mojom.h"
#include "mojo/public/cpp/bindings/remote.h"
@@ -59,7 +58,6 @@ class SafeArchiveAnalyzer : public chrome::mojom::SafeArchiveAnalyzer {
void Timeout();
safe_browsing::ZipAnalyzer zip_analyzer_;
- safe_browsing::RarAnalyzer rar_analyzer_;
// A timer to ensure no archive takes too long to unpack.
base::OneShotTimer timeout_timer_;
--
2.25.1