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

Side by Side Diff: chrome/browser/safe_browsing/download_protection_service.cc

Issue 8536035: Include the full certificate chain in the download pingback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/safe_browsing/download_protection_service.h" 5 #include "chrome/browser/safe_browsing/download_protection_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 396
397 private: 397 private:
398 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; 398 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
399 friend class DeleteTask<CheckClientDownloadRequest>; 399 friend class DeleteTask<CheckClientDownloadRequest>;
400 400
401 virtual ~CheckClientDownloadRequest() { 401 virtual ~CheckClientDownloadRequest() {
402 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 402 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
403 } 403 }
404 404
405 void ExtractFileFeatures() { 405 void ExtractFileFeatures() {
406 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 406 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
mattm 2011/11/12 03:15:36 Probably want to move to doing this with WorkerPoo
Ryan Sleevi 2011/11/12 22:06:17 drive-by: +1 to this. These calls can take upwards
407 signature_util_->CheckSignature(info_.local_file, &signature_info_); 407 signature_util_->CheckSignature(info_.local_file, &signature_info_);
408 bool is_signed = signature_info_.has_certificate_contents(); 408 bool is_signed = (signature_info_.certificate_chain_size() > 0);
409 if (is_signed) { 409 if (is_signed) {
410 VLOG(2) << "Downloaded a signed binary: " << info_.local_file.value(); 410 VLOG(2) << "Downloaded a signed binary: " << info_.local_file.value();
411 } else { 411 } else {
412 VLOG(2) << "Downloaded an unsigned binary: " << info_.local_file.value(); 412 VLOG(2) << "Downloaded an unsigned binary: " << info_.local_file.value();
413 } 413 }
414 UMA_HISTOGRAM_BOOLEAN("SBClientDownload.SignedBinaryDownload", is_signed); 414 UMA_HISTOGRAM_BOOLEAN("SBClientDownload.SignedBinaryDownload", is_signed);
415 415
416 // TODO(noelutz): DownloadInfo should also contain the IP address of every 416 // TODO(noelutz): DownloadInfo should also contain the IP address of every
417 // URL in the redirect chain. We also should check whether the download 417 // URL in the redirect chain. We also should check whether the download
418 // URL is hosted on the internal network. 418 // URL is hosted on the internal network.
(...skipping 28 matching lines...) Expand all
447 const GURL& url = info_.download_url_chain[i]; 447 const GURL& url = info_.download_url_chain[i];
448 if (url.is_valid() && sb_service_->MatchDownloadWhitelistUrl(url)) { 448 if (url.is_valid() && sb_service_->MatchDownloadWhitelistUrl(url)) {
449 reason = REASON_WHITELISTED_URL; 449 reason = REASON_WHITELISTED_URL;
450 break; 450 break;
451 } 451 }
452 } 452 }
453 if (info_.referrer_url.is_valid() && reason == REASON_MAX && 453 if (info_.referrer_url.is_valid() && reason == REASON_MAX &&
454 sb_service_->MatchDownloadWhitelistUrl(info_.referrer_url)) { 454 sb_service_->MatchDownloadWhitelistUrl(info_.referrer_url)) {
455 reason = REASON_WHITELISTED_REFERRER; 455 reason = REASON_WHITELISTED_REFERRER;
456 } 456 }
457 if (reason != REASON_MAX || signature_info_.has_certificate_contents()) { 457 if (reason != REASON_MAX ||
458 signature_info_.certificate_chain_size() > 0) {
458 UMA_HISTOGRAM_COUNTS("SBClientDownload.SignedOrWhitelistedDownload", 1); 459 UMA_HISTOGRAM_COUNTS("SBClientDownload.SignedOrWhitelistedDownload", 1);
459 } 460 }
460 } 461 }
461 if (reason != REASON_MAX) { 462 if (reason != REASON_MAX) {
462 RecordImprovedProtectionStats(reason); 463 RecordImprovedProtectionStats(reason);
463 CheckDigestList(); 464 CheckDigestList();
464 } else if (!pingback_enabled_) { 465 } else if (!pingback_enabled_) {
465 RecordImprovedProtectionStats(REASON_PING_DISABLED); 466 RecordImprovedProtectionStats(REASON_PING_DISABLED);
466 CheckDigestList(); 467 CheckDigestList();
467 } else { 468 } else {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 620
620 void DownloadProtectionService::RequestFinished( 621 void DownloadProtectionService::RequestFinished(
621 CheckClientDownloadRequest* request) { 622 CheckClientDownloadRequest* request) {
622 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 623 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
623 std::set<scoped_refptr<CheckClientDownloadRequest> >::iterator it = 624 std::set<scoped_refptr<CheckClientDownloadRequest> >::iterator it =
624 download_requests_.find(request); 625 download_requests_.find(request);
625 DCHECK(it != download_requests_.end()); 626 DCHECK(it != download_requests_.end());
626 download_requests_.erase(*it); 627 download_requests_.erase(*it);
627 } 628 }
628 } // namespace safe_browsing 629 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698