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

Unified Diff: chrome/common/safe_browsing/download_protection_util.cc

Issue 1262753002: [SafeBrowsing] Send pings for Zip files that contain other archives. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
Index: chrome/common/safe_browsing/download_protection_util.cc
diff --git a/chrome/common/safe_browsing/download_protection_util.cc b/chrome/common/safe_browsing/download_protection_util.cc
index ab8630f801a9d29c6ae03d617d668e8c781b4ae2..422d7e3015652089e3d7f760593b7e539d91f998 100644
--- a/chrome/common/safe_browsing/download_protection_util.cc
+++ b/chrome/common/safe_browsing/download_protection_util.cc
@@ -11,14 +11,22 @@ namespace safe_browsing {
namespace download_protection_util {
bool IsArchiveFile(const base::FilePath& file) {
+ const base::FilePath::CharType* kArchiveFileTypes[] = {
+ FILE_PATH_LITERAL(".zip"),
+ FILE_PATH_LITERAL(".rar"),
+ FILE_PATH_LITERAL(".7z"),
+ FILE_PATH_LITERAL(".cab"),
+ };
+ for (const auto& extension : kArchiveFileTypes)
+ if (file.MatchesExtension(extension))
+ return true;
// TODO(mattm): should .dmg be checked here instead of IsBinaryFile?
- return file.MatchesExtension(FILE_PATH_LITERAL(".zip"));
+ return false;
}
bool IsBinaryFile(const base::FilePath& file) {
const base::FilePath::CharType* kSupportedBinaryFileTypes[] = {
// Executable extensions for MS Windows.
- FILE_PATH_LITERAL(".cab"),
FILE_PATH_LITERAL(".cmd"),
FILE_PATH_LITERAL(".com"),
FILE_PATH_LITERAL(".dll"),
@@ -83,8 +91,8 @@ ClientDownloadRequest::DownloadType GetDownloadType(
return ClientDownloadRequest::ANDROID_APK;
else if (file.MatchesExtension(FILE_PATH_LITERAL(".crx")))
return ClientDownloadRequest::CHROME_EXTENSION;
- // For zip files, we use the ZIPPED_EXECUTABLE type since we will only send
- // the pingback if we find an executable inside the zip archive.
+ // For .zip files, we send the ZIPPED_EXECUTABLE type although the type may
+ // change to ZIPPED_ARCHIVE based on the zip analyzer.
mattm 2015/07/29 22:53:25 still a little confusing.. maybe "we initially set
asanka 2015/07/31 01:04:42 Reworded.
else if (file.MatchesExtension(FILE_PATH_LITERAL(".zip")))
return ClientDownloadRequest::ZIPPED_EXECUTABLE;
else if (file.MatchesExtension(FILE_PATH_LITERAL(".dmg")) ||

Powered by Google App Engine
This is Rietveld 408576698