description: disable support for safe browsing inspection of rar files
author: Andres Salomon <dilinger@debian.org>
bug: http://bugs.debian.org/914487

--- a/chrome/common/safe_browsing/BUILD.gn
+++ b/chrome/common/safe_browsing/BUILD.gn
@@ -137,7 +137,6 @@ source_set("safe_browsing") {
       "//components/safe_browsing/content/common:file_type_policies",
       "//components/safe_browsing/core/common",
       "//third_party/lzma_sdk/google:seven_zip_reader",
-      "//third_party/unrar:unrar",
     ]
 
     public_deps = [
--- a/chrome/browser/safe_browsing/download_protection/file_analyzer.cc
+++ b/chrome/browser/safe_browsing/download_protection/file_analyzer.cc
@@ -78,7 +78,10 @@ void FileAnalyzer::Start(const base::Fil
   if (inspection_type == DownloadFileType::ZIP) {
     StartExtractZipFeatures();
   } else if (inspection_type == DownloadFileType::RAR) {
-    StartExtractRarFeatures();
+    LOG(ERROR) << "Safebrowser checking of rar files is disabled, open at your own risk!";
+    results_.archive_summary.set_parser_status(
+        ClientDownloadRequest::ArchiveSummary::PARSER_TIMED_OUT);
+    std::move(callback_).Run(std::move(results_));
 #if BUILDFLAG(IS_MAC)
   } else if (inspection_type == DownloadFileType::DMG) {
     StartExtractDmgFeatures();
--- a/chrome/services/file_util/safe_archive_analyzer.cc
+++ b/chrome/services/file_util/safe_archive_analyzer.cc
@@ -86,10 +86,10 @@ void SafeArchiveAnalyzer::AnalyzeRarFile
                               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(ERROR) << "AnalyzeRarFile is disabled in this build";
+  results_.success = false;
+  results_.analysis_result = safe_browsing::ArchiveAnalysisResult::kFailedToOpen;
+  std::move(callback_).Run(results_);
 }
 
 void SafeArchiveAnalyzer::AnalyzeSevenZipFile(
--- 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 chrom
   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_;
--- a/chrome/utility/safe_browsing/archive_analyzer.cc
+++ b/chrome/utility/safe_browsing/archive_analyzer.cc
@@ -8,7 +8,6 @@
 #include "build/build_config.h"
 #include "build/buildflag.h"
 #include "chrome/common/safe_browsing/archive_analyzer_results.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 "components/safe_browsing/content/common/proto/download_file_types.pb.h"
@@ -24,7 +23,8 @@ namespace safe_browsing {
 std::unique_ptr<ArchiveAnalyzer> ArchiveAnalyzer::CreateForArchiveType(
     DownloadFileType_InspectionType file_type) {
   if (file_type == DownloadFileType::RAR) {
-    return std::make_unique<RarAnalyzer>();
+    LOG(ERROR) << "AnalyzeRarFile is disabled in this build";
+    return nullptr;
   } else if (file_type == DownloadFileType::ZIP) {
     return std::make_unique<ZipAnalyzer>();
   } else if (file_type == DownloadFileType::SEVEN_ZIP) {
--- 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",
@@ -55,7 +53,6 @@ source_set("safe_browsing") {
       "//components/safe_browsing/content/common:file_type_policies",
       "//components/safe_browsing/core/common",
       "//third_party/lzma_sdk/google:seven_zip_reader",
-      "//third_party/unrar:unrar",
       "//third_party/zlib",
     ]
 
