Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3570)

Unified Diff: chrome/browser/safe_browsing/download_protection_service.cc

Issue 2934373002: Record Code Signature of Downloaded DMG files (Closed)
Patch Set: correcting rebase mixup Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/download_protection_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/download_protection_service.cc
diff --git a/chrome/browser/safe_browsing/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection_service.cc
index 822e3353b9a3da82be9a99804359dcc5915f5a56..a8400aaf290233ce442e22dbab477185bf2126ce 100644
--- a/chrome/browser/safe_browsing/download_protection_service.cc
+++ b/chrome/browser/safe_browsing/download_protection_service.cc
@@ -362,6 +362,9 @@ class DownloadProtectionService::CheckClientDownloadRequest
tab_referrer_url_(item->GetTabReferrerUrl()),
archived_executable_(false),
archive_is_valid_(ArchiveValid::UNSET),
+#if defined(OS_MACOSX)
+ disk_image_signature_(nullptr),
+#endif
callback_(callback),
service_(service),
binary_feature_extractor_(binary_feature_extractor),
@@ -826,6 +829,11 @@ class DownloadProtectionService::CheckClientDownloadRequest
if (!service_)
return;
+ if (results.signature_blob.size() > 0) {
+ disk_image_signature_ =
+ base::MakeUnique<std::vector<uint8_t>>(results.signature_blob);
+ }
+
// Even if !results.success, some of the DMG may have been parsed.
archive_is_valid_ =
(results.success ? ArchiveValid::VALID : ArchiveValid::INVALID);
@@ -1071,6 +1079,18 @@ class DownloadProtectionService::CheckClientDownloadRequest
request.mutable_referrer_chain());
}
+#if defined(OS_MACOSX)
+ UMA_HISTOGRAM_BOOLEAN(
+ "SBClientDownload."
+ "DownloadFileHasDmgSignature",
+ disk_image_signature_ != nullptr);
+
+ if (disk_image_signature_) {
+ request.set_udif_code_signature(disk_image_signature_->data(),
+ disk_image_signature_->size());
+ }
+#endif
+
if (archive_is_valid_ != ArchiveValid::UNSET)
request.set_archive_valid(archive_is_valid_ == ArchiveValid::VALID);
request.mutable_signature()->CopyFrom(signature_info_);
@@ -1266,6 +1286,10 @@ class DownloadProtectionService::CheckClientDownloadRequest
bool archived_executable_;
ArchiveValid archive_is_valid_;
+#if defined(OS_MACOSX)
+ std::unique_ptr<std::vector<uint8_t>> disk_image_signature_;
+#endif
+
ClientDownloadRequest_SignatureInfo signature_info_;
std::unique_ptr<ClientDownloadRequest_ImageHeaders> image_headers_;
google::protobuf::RepeatedPtrField<ClientDownloadRequest_ArchivedBinary>
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/download_protection_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698